Example 9-4: Embedding lookup information inside the stylesheet itself

<!-- TranslateTripCodeInternal.xsl: Lookup Codes from inside stylesheet -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:m="temp">
  <!-- Import the identity transformation. -->
  <xsl:import href="Identity.xsl"/>
  <!-- Parameterize language for lookup code translation, default to "en" -->
  <xsl:param name="lang" select="'en'"/>
  <!-- Select root node of stylesheet lookup codes  -->
  <xsl:variable name="codes" select="document('')/xsl:stylesheet/m:Lookup"/>
  <!--
   | Whenever you match a Purpose element, replace numeric value by
   | lookup up codes from external file.
   +-->
  <xsl:template match="Purpose">
    <xsl:copy>
      <xsl:value-of 
         select="$codes/m:Msg[@id=current()]/m:Text[@lang=$lang]"/>
    </xsl:copy>
  </xsl:template>

  <!-- Lookup Codes inside the stylesheet must be qualified by a namespace -->
  <m:Lookup>
     <m:Msg id="101">
        <m:Text lang="it">Vacanze</m:Text>
        <m:Text lang="en">Vacation</m:Text>
     </m:Msg>
     <m:Msg id="102">
        <m:Text lang="it">Affari</m:Text>
        <m:Text lang="en">Work</m:Text>
     </m:Msg>
  </m:Lookup>
</xsl:stylesheet>