RE: [xsl] keyed lookup table

Subject: RE: [xsl] keyed lookup table
From: "Pawson, David" <David.Pawson@xxxxxxxxxxx>
Date: Fri, 18 Feb 2005 10:31:19 -0000
    -----Original Message-----
    From: David Carlisle

    > that I would access with this expression:
    > 	key('language-code', 'de', $stylesheet)"/>
    >  given:
    > 	<xsl:variable name="stylesheet" select="document('')"/>

    no don't do that, although it ought to work, it causes the
    stylesheet to be re-parsed. In 2.0 you can query into
    variables so you can just use $language-table  instead of

Neat :-)
<name code="de">


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="";

<xsl:variable name="language-table">
  <!-- See ISO 639 -->
  <name code="ar">ARABIC</name>
  <name code="de">GERMAN</name>
  <name code="en">ENGLISH</name>
  <name code="zh">CHINESE</name>

  <xsl:output method="xml" indent="yes" encoding="utf-8"/>

  <xsl:template match="/">

<xsl:variable name="stylesheet" select="document('')"/>
<xsl:key name="language-code" match="name" use="@code"/>

  <xsl:template match="name">
Document is in  [<xsl:value-of select="key('language-code',


<?xml version="1.0" encoding="utf-8"?>
Document is in  [GERMAN]

regards DaveP.


NOTICE: The information contained in this email and any attachments is
confidential and may be privileged.  If you are not the intended
recipient you should not use, disclose, distribute or copy any of the
content of it or of any attachment; you are requested to notify the
sender immediately of your receipt of the email and then to delete it
and any attachments from your system.

RNIB endeavours to ensure that emails and any attachments generated by
its staff are free from viruses or other contaminants.  However, it
cannot accept any responsibility for any  such which are transmitted.
We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email and
any attachments are those of the author and do not necessarily represent
those of RNIB.

RNIB Registered Charity Number: 226227


Current Thread