1<xsl:transform
2  version="1.0"
3  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4  xmlns:exsl="http://exslt.org/common"
5  extension-element-prefixes="exsl">
6
7  <xsl:key name="k" match="a" use="@x"/>
8
9  <xsl:template match="/">
10    <xsl:variable name="v">
11      <n>
12        <a x="1" y="A"/>
13        <a x="2" y="B"/>
14      </n>
15    </xsl:variable>
16    <xsl:apply-templates select="exsl:node-set($v)/*"/>
17  </xsl:template>
18
19  <xsl:template match="n">
20<!--    <xsl:apply-templates select="a[@x='1']"/> -->
21    <xsl:apply-templates select="key('k','1')"/>
22  </xsl:template>
23
24  <xsl:template match="a">
25    <xsl:value-of select="@y"/>
26  </xsl:template>
27
28</xsl:transform>
29