1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4    xmlns:test="http://www.example.org/test">
5  <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
6
7  <xsl:key name="k" match="test:a" use="@a"/>
8  <xsl:key name="k" match="test:b" use="@b"/>
9  <xsl:key name="k" match="test.a" use="@a"/>
10
11  <xsl:template match="/">
12    <test:data>
13      <xsl:for-each select="key('k','1')">
14        <xsl:copy-of select="."/>
15      </xsl:for-each>
16    </test:data>
17  </xsl:template>
18
19  <xsl:template match="text()|@*"/>
20
21  <test:data>
22    <test:a a="1"/>
23    <test:b b="1"/>
24  </test:data>
25</xsl:stylesheet>
26
27