I've reformatted my question:
Input XML:
<x>
<define name="DEF1">
<reg name="REG1"/>
</define>
<define name="DEF2">
<reg name="REG2"/>
<ref name="DEF1"/>
</define>
<block name="block1">
<reg name="REG4"/>
<reg name="REG3"/>
<ref name="DEF2"/>
</block>
</x>
----------------------
Output Expected XML:
<block name="block1">
<reg name="REG4"/>
<reg name="REG3"/>
<reg name="REG2"/>
<reg name="REG1"/>
</block>
----------------------
But when I apply the following stylesheet I get the following: (Note the
missing REG1 node)
<block name="block1">
<reg name="REG4"/>
<reg name="REG3"/>
<reg name="REG2"/>
</block>
----------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="*" >
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="ref[(_at_)name]">
<xsl:variable name="x">
<xsl:copy-of select="//define[(_at_)name=current()/@name]/*"/>
</xsl:variable>
<xsl:apply-templates select="$x"/>
</xsl:template>
<xsl:template match="/*/define"/>
</xsl:stylesheet>
Thanks,
Anupam.
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
--~------------------------------------------------------------------
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>
--~--