xsl-list
[Top] [All Lists]

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

2006-06-22 08:46:10
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


--~------------------------------------------------------------------
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>
--~--