[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] id idref pairs
Subject: [xsl] id idref pairs From: DPawson@xxxxxxxxxxx Date: Mon, 12 Feb 2001 14:01:06 -0000 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] diff between direct call , Mike Brown | Thread | RE: [xsl] id idref pairs, DPawson |
Re: [xsl] XSLT-schema, Eric van der Vlist | Date | RE: [xsl] id idref pairs, DPawson |
Month |
Keywords