Subject: [xsl] Recursive substitution From: Agnisys <agnisys@xxxxxxxxx> Date: Fri, 4 Nov 2005 11:55:14 -0800 (PST) |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Recursive substitution, Agnisys | Thread | Re: [xsl] Recursive substitution, Wendell Piez |
RE: [xsl] Re: Re: Change of Attribu, Michael Kay | Date | [xsl] Matching certain elements fol, Matthew Fonda |
Month |