Re: [xsl] Merging attributes in one XML file with node values in another (identical structure)

Subject: Re: [xsl] Merging attributes in one XML file with node values in another (identical structure)
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 22 Jun 2006 11:43:45 -0400
At 10:59 AM 6/22/2006, David wrote:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="*">
 <xsl:copy>
  <xsl:variable name="n" select="1+count(preceding::*)+count(ancestor::*)"/>
  <xsl:copy-of select="document('m2.xml')/descendant::*[$n]/@*"/>
  <xsl:apply-templates/>
 </xsl:copy>
</xsl:template>

</xsl:stylesheet>

Blow me away.


Actually I'm consoled a bit since even David's awesomely elegant solution works by applying a simple rule (which my non-mathematician brain had forgotten) to tell if two nodes are "the same"....

Cheers,
Wendell

Current Thread