1<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
2
3  <xsl:output encoding="utf-8"/>
4
5  <xsl:template match="item">
6      <item>
7         <xsl:value-of select="@name"/>
8
9      </item>
10  </xsl:template>
11
12  <xsl:template match="//blah">
13      <first>
14         <xsl:apply-templates select="//glossary/item[@name=current()/@ref]"/>
15      </first>
16      <second>
17         <xsl:apply-templates select="//glossary/item[@name=./@ref]"/>
18      </second>
19      <third>
20         <xsl:apply-templates select="//glossary/item[@name=@ref]"/>
21      </third>
22  </xsl:template>
23</xsl:stylesheet>
24