[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

id idref pairs

Subject: id idref pairs
From: DPawson@xxxxxxxxxxx
Date: Mon, 12 Feb 2001 14:01:06 -0000
xsl id idref
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
  • id idref pairs
    • DPawson - Mon, 12 Feb 2001 09:07:27 -0500 (EST) <=
      • <Possible follow-ups>
      • DPawson - Mon, 12 Feb 2001 09:37:45 -0500 (EST)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.