[Home] [By Thread] [By Date] [Recent Entries]
Here is a Saxon (8.7.3J) specific solution:
file1.xml
------------
<a>
<b>
<node>1</node>
</b>
<c>
<d>
<node>2</node>
</d>
</c>
</a>file2.xml
------------
<a>
<b val="x">
<node width="10"/>
</b>
<c>
<d val="z">
<node height="15"/>
</d>
</c>
</a>merge.xsl
--------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://saxon.sf.net/"><xsl:output method="xml" indent="yes" /> <xsl:variable name="file2" select="document('file2.xml')" /> <xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="$file2//*[saxon:path() =
current()/saxon:path()]/@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template></xsl:stylesheet> java net.sf.saxon.Transform file1.xml merge.xsl
Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
<?xml version="1.0" encoding="UTF-8"?>
<a>
<b val="x">
<node width="10">1</node>
</b>
<c>
<d val="z">
<node height="15">2</node>
</d>
</c>
</a>Regards, Mukul On 6/22/06, Minervini, Chris <christopher.minervini@xxxxxxxxxx> wrote: O.K. here's my question. It seems like it should be simple but I can't figure it out. I have two XML files. One with data in the node values, and one with data in attributes. They have the same exact structure.
|

Cart



