Key Example

Figure 27. keys.xsl

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

<xsl:key name="bibkey" match="//biblio/bib" use="@abbrev"/>

<xsl:template match="doc">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="biblio">
  <!-- suppressed -->
</xsl:template>

<xsl:template match="para">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="bibref">
  <xsl:variable name="bib" select="key('bibkey',string(.))"/>
  <xsl:choose>
    <xsl:when test="$bib">
      <i><xsl:apply-templates select="$bib"/></i>
    </xsl:when>
    <xsl:otherwise>
      <b>NO BIB FOR <xsl:apply-templates/></b>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template match="bib">
  <xsl:apply-templates/>
</xsl:template>

</xsl:stylesheet>



Figure 28. keys.xml

<doc>
<para>See <bibref>xyzzy</bibref>.</para>
<biblio>
<bib abbrev="xyzzy">The Great Grue</bib>
<bib abbrev="abcde">That Alphabet Song</bib>
</biblio>
</doc>


Figure 29. keys.html

<?xml version="1.0" encoding="utf-8" ?>
See <i>The Great Grue</i>.