This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: using document() function in match attribute of xsl:keyelement- possible?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]