This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
referencing elements
- From: Andreas Leitner <nozone at sbox dot tugraz dot at>
- To: xsl-list at lists dot mulberrytech dot com
- Date: 29 Mar 2002 02:53:29 +0100
- Subject: [xsl] referencing elements
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
I am pretty new to XSLT and have a problem I cannot solve. I am posting
here, hoping some kind soul is friendly enough to enlighten me (; -
thanks in advance
I have a xml input document like this:
<root>
<chapter name="foo">
this is all about foo
</chapter>
<chapter name="bar">
this is all about bar
</chapter>
<chapter name="baz">
this is all about baz.
you might want to have a look at chapter
<link id="bar"/> too.
</chapter>
</root>
Now I would like to generate some nice html out of this and convert the
"link" element into a true hyperreference
therefore in my stylesheet i have something along the lines (not with
true hyperlinks yet, but just to demonstrate ids:
<xsl:template select="chapter"
id of this chapter is: <xsl:value-of select"generate-id()"/>
<br/>
to demonstrate a link:
<xsl:value-of select="/chapter[@name=???]"/>
</xsl:template>
Now the ??? part is what i don't know how to solve. My first go was to
write:
select="/chapter[@name=@id]"
or:
select="/chapter[@name=./@id]"
Hoping that somehow i could access the node that the current template
rule matched, but it seems in square brackets the context node is
overruled.
Anybody knows how to do this?
Also, I would like to produce one html page per chapter. Is there a
chance I can do this without post-processing the result?
thank you very much in advance,
Andreas
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list