|
Subject: Re: [xsl] xsl value-of From: "Joerg Heinicke" <joerg.heinicke@xxxxxx> Date: Tue, 2 Apr 2002 22:41:57 +0200 |
> 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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] xsl value-of, Matias Woloski | Thread | Re: [xsl] xsl value-of, Jeni Tennison |
| Re: [xsl] sequence numbering., Chuck Paussa | Date | [xsl] Softball question -- hopefull, Steve Rosenberry |
| Month |