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

Re: xsl value-of

Subject: Re: xsl value-of
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
Date: Tue, 2 Apr 2002 22:41:57 +0200
Re:  xsl value-of
> Jeni and Joerg, thank you very much for your help.
> It finally worked!
> I've used
> <xsl:key name="labels" match="label" use="concat(../../@id, '_', @id)"/>
>
> I didn't understand why I have to put only label and not label/text()
>
> thanks again,
> Matias

Hello Matias,

with the key-declaration above and using key('labels', ...) you always get
back a nodeset which contains the matching label-elements. This is similar
to any XPATH-expression "navigating" to this label element. And as you can
do

<xsl:value-of select="../../bla/foo/label/@id"/>

you also can do

<xsl:value-of select="key('labels', 'string')/@id"/>

Using label/text() in the match-attribute of the key-declaration is not
wrong, but ... let's say unusual. Because for creating the key, you must go
one step back more:

<xsl:key name="labels" match="label/text()" use="concat(../../../@id, '_',
../@id)"/>

On the other hand your key() can be shorter: <xsl:value-of
select="key('labels', ...)"/> with "label" in the declaration gives you the
text-nodes of all matching label-elements and it's descendant elements. With
label/text() only the text-nodes of the matching label-elements. Our key()
has to be "key('labels', ...)/text()" to have the same effect as yours.

Maybe Jeni can it explain it better, more explicitely, but I hope you can
see, what I want to say ;-)

Joerg


 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.