xsl-list
[Top] [All Lists]

Re: xsl:key function help

2005-08-03 08:09:02
Hi,
Tempore 17:02:15, die 08/03/2005 AD, hinc in 
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit David Preuss 
<d(_dot_)preuss(_at_)de(_dot_)kddi(_dot_)com>:

as a newbie I tried to play with the key function but didnt get it.

<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:key name="Categories" match="Tip" use="@Topic" />
<xsl:output method="xml"/>
        
        <xsl:template match="/">
                <xsl:value-of select="count(key('Categories',Topic))"/>
        </xsl:template>

</xsl:stylesheet>

Yous set up the key correctly, you're only calling the wrong reference:

<xsl:value-of select="count(key('Categories',Topic))"/>
'Topic' is interpreted as 'child::Topic' : the child element (of the current 
node) named 'Topic'.

A correct value could be:
<xsl:value-of select="count(key('Categories','Microsoft'))"/>

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
«Η αλήθεια και το λάδι πάντα βγαίνουν από πάνω»

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>