[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|