|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] id idref pairs
I have xml which looks like
<doc>
<test id="x">
</test>
<test>
link to <link idref="x"/>blah
</test>
</doc>
I want to output, in html,
<p>link to TN 1 blah</p>
I have
<xsl:template match="link">
TN&sp; <a href="#{@idref}">
<xsl:call-template name="testnum" >
<xsl:with-param name="node" select="@idref"/>
</xsl:call-template></a>
<xsl:apply-templates/>
</xsl:template>
<xsl:template name="testnum">
<xsl:param name="node" select="."/>
<xsl:choose>
<xsl:when test="id($node)">
<xsl:for-each select="id($node)">
<xsl:text>TN:&sp;</xsl:text><xsl:number count="test"
level="any"/><xsl:text>&sp;</xsl:text>
</xsl:for-each></xsl:when>
<xsl:otherwise><xsl:text>No TN for link</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
My intent (not currently working), is to provide as output, the
number of the test in the document, by changing context from the calling
test
to that of the called test. I *think* the id(@idref) gives me the
target node, and in the testnum context, the for-each changes context.
The test is to ensure I have the id attribute in the target element.
Its not working. And I can't see why.
Any help appreciated.
TIA, DaveP
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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








