[xsl] Replacing matching values with values from another document?

Subject: [xsl] Replacing matching values with values from another document?
From: "Edmund Mitchell" <emitchell@xxxxxxxx>
Date: Mon, 5 Mar 2007 16:26:19 -0800
Hi all,

Can't seem to wrap my head around a starting point.  I apologize for asking,
because it feels like a solution should be obvious to this one, but I'm
drawing a blank.

More or less an identity transform on docA, execpt where I find and element
name match in doc B.  In that case, element &/or att values from docB
overwrite their counterparts in docA.
I haven't seem sample xml yet, but I'm told the docs will be both mostly
flat and extremely similar, so I'm working on the following "guess sample":

[docA.xml]

<docA>
   <a><a/>  
   <b>fred</b>
   <c att="value1"/>
   <e>  <-- no "override" in docB, so it comes forward into the result
</docA>

[docB.xml]

<docB>
   <a/>             <-- no need to change docA
   <b>ethel</b>     <-- "fred" in docA would have to be changed to "ethel"
   <c att="value2"/>  <-- "value1" in docA has to become "value2"
   <d att="foo"> doesn't match </d>  <-- dropped on floor, no element name
match
</docB>

I checked Dave Pawson's great FAQ, but couldn't seem to adapt any example.
XSLT 1 or 2 is just fine; using saxon 8.9.

Thanks,

Edmund

Current Thread