|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Recursive substitution
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[@name]">
<xsl:variable name="x">
<xsl:copy-of select="//define[@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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








