Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - How to create an xsl:key using an attribute of an element in another namespace >Thread Next - Re: How to create an xsl:key using an attribute of an element in another namespace Re: How to create an xsl:key using an attribute of an element in another namespaceTo: NULL Date: 2/5/2006 10:54:00 AM
"style" <!spam.g.host@m...> wrote in message
news:43e53199_3@n......
> Hi everybody
>
> In the following sample I'm trying to create an xsl:key using the
> @fileExtension attribute of the data:IconInfo elements. Unfortunately this
> syntax doesn't work. Does anybody have an idea what I'm doing wrong?
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:data="http://example/icon-info" extension-element-prefixes="data">
> <data:IconInfos>
> <data:IconInfo fileExtension="pdf" iconUrl="Images/icon_pdf.gif" />
> <data:IconInfo fileExtension="zip" iconUrl="Images/icon_zip.gif" />
> <data:IconInfo fileExtension="txt" iconUrl="Images/icon_txt.gif" />
> </data:IconInfos>
> <xsl:key name="iconInfoLookup" match="data:IconInfos/data:IconInfo"
> use="@fileExtension"/>
> </xsl:stylesheet>
>
> Kind regards
> Thomas
The <xsl:key> instruction above is a valid one. What do you mean by "is not
working"?
You haven't shown the code that references this xsl:key using the key()
function.
Most probably, not getting the expected results is due to the fact that the
current document is not the one that is intended to be indexed (my guess is
that the intended one is the stylesheet itself -- if so, make document('')
the current node and (this is what xsl:for-each is for -- among other
things) then in this context evaluate the key() function).
Cheers,
Dimitre Novatchev
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
