<xsl:transform version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!--
 ! This transform provides a guide towards defining
 ! XML macros using XSLT. We expand only our XML
 ! extensions, and preserve everything else in a
 ! document.
 +-->

<xsl:template match="node()">
  <!--
   ! This is an identity template in XSLT. However,
   ! due to the very low specificity (a technical
   ! aspect of XSLT) of the match, other templates
   ! will override this one when they match.
   +-->
  <xsl:copy>
    <xsl:for-each select="attribute::*">
      <xsl:copy/>
      </xsl:for-each>
    <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

<xsl:template match="bi">
  <!--
   ! This defines the element 'bi',
   ! which is both bold and italic.
   +-->
  <b><i>
    <xsl:apply-templates/>
    </i></b>
  </xsl:template>

<xsl:template match="def">
  <!--
   ! This defines the element 'def',
   ! which provides a link to search the web
   ! for the definition of a term.
   +-->
  <a href="http://google.com/search?q=define%3A{.}">
    <xsl:value-of select='.'/>
    </a>
  </xsl:template>

</xsl:transform>

