Hi,
This problem is about how to create a recursive reference node and resolve it
using XSL.
My XML looks like this:
<define name="DEF1">
<reg name="REG1"/>
</define>
<define name="DEF2">
<reg name="REG2"/>
<ref name="DEF1"/>
</define>
<block name="block1">
<reg name="REG3"/>
<ref name="DEF2"/>
</block>
The output I need is :
Register : REG3
Register : REG2
Register : REG1
But I don't get the last line. In other words, the "ref" call is not resovling
recursively.
My XSL looks like this :
-------
<xsl:template match="/">
<xsl:variable name="x">
<xsl:apply-templates mode="pass1"/>
</xsl:variable>
<xsl:apply-templates mode="pass2" select="$x"/>
</xsl:template>
<xsl:template match="*" mode="pass1">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="#current"/>
</xsl:copy>
</xsl:template>
<xsl:template match="define" mode="pass1">
</xsl:template>
<xsl:template match="ref[(_at_)name]" mode="pass1">
<xsl:variable name="x">
<xsl:copy-of select="//define[(_at_)name=current()/@name]/*"/>
</xsl:variable>
<xsl:apply-templates select="$x" mode="#current"/>
</xsl:template>
<xsl:template match="reg" mode="pass2">
<br/>Register : <xsl:value-of select="@name"/><br/>
</xsl:template>
-------------------------------
A follow up question is, in this kind of multi-pass processing, is there a way
to dump out the
results after a pass to aid debug?
Thanks,
Anupam.
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.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>
--~--