Re: [xsl] using document() function in match attribute of xsl:key element- possible?

Subject: Re: [xsl] using document() function in match attribute of xsl:key element- possible?
From: "Swen Thuemmler" <Swen.Thuemmler@xxxxxxxxxxxx>
Date: Thu, 10 May 2001 18:54:03 +0200 (MET DST)
On Thu, 10 May 2001, Mike McGraw wrote:

[...]

> <xsl:key name="people" match="document('people.xml')/data/person"
> use="@size"/>
> 
> and then later in the stylesheet, to display a list of all people who wear
> medium size shirts, I would do this:
> 
> <xsl:for-each select="key('people','M')">
> <xsl:value-of select="."/><br/>
> </xsl:for-each>

I believe the correct way is:
<xsl:key name="people" match="/data/person" use="@size"/>

...

<xsl:for-each select="document('people.xml')"> <!-- change context -->
  <xsl:for-each select="key('people', 'M')">
    <xsl:value-of select="."/><br/>
  </xsl:for-each>
</xsl:for-each>

(I did not test this, I might be wrong...)

--Swen


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread