This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: id idref pairs


Sorry folks. fooled again
Needed the minimal 
<!DOCTYPE testspec [
<!ATTLIST test id ID #IMPLIED>
]>
at the top of the file, to make id's ID's if you see what I mean :-)

Sorry to waste bandwidth.

DaveP


> 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
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]