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

referencing elements

Subject: referencing elements
From: Andreas Leitner <nozone@xxxxxxxxxxxxxx>
Date: 29 Mar 2002 02:53:29 +0100
hyperreference xml
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


Current Thread

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.