[xsl] Who can give me tech info about xsl:key and key()? (was: Lookup in a xml file with a key)

Subject: [xsl] Who can give me tech info about xsl:key and key()? (was: Lookup in a xml file with a key)
From: Rene de Vries <RdVries@xxxxxxxxxxx>
Date: Tue, 10 Jul 2001 15:24:06 +0200
Hi xsl:key/key()-experts,

I've seen more of these XSL's as shown below and I'm surprised that they 
work.
Could someone give me more technical info about how it works?
What surprises me is that you declare an xsl:key at the top of the XSL, for 
a second XML-file which is to be read by the document()-function. So is it 
possible to use xsl:key for multiple XML's and how do you use the 
key()-function then?
And when is the key-table build, what is its scope and how must I imagine 
such a table (if it is one)?

Greetings Rene
   { @   @ }
        ^
      \__/

"You don't need eyes to see, you need vision!"

-----Oorspronkelijk bericht-----
Van:	Dimitre Novatchev [SMTP:dnovatchev@xxxxxxxxx]
Verzonden:	dinsdag 10 juli 2001 12:53
Aan:	gaston_annebicque@xxxxxxxxx
CC:	xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Onderwerp:	[xsl] Re: Lookup in a xml file with a key

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output indent="yes" omit-xml-declaration="yes"/>
  <xsl:key name="kLookup" match="name" use="../abbr"/>

  <xsl:template match="/">
    <out>
      <xsl:apply-templates select="in/country"/>
      <xsl:text>&#xA;</xsl:text>
    </out>
  </xsl:template>

<xsl:template match="country">
    <xsl:variable name="input" select="."/>
     <xsl:for-each select="document('lookup2.xml')">
        <xsl:for-each select="key('kLookup',$input)">
            <xsl:text>&#xA;</xsl:text>
            <xsl:value-of select="."/>
        </xsl:for-each>
     </xsl:for-each>
</xsl:template>
</xsl:stylesheet>



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


Current Thread