xsl-list
[Top] [All Lists]

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

2007-03-05 17:26:52
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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>