W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2003

Re: TR/xquery-operators/#func-doc

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 14 May 2003 09:54:04 +0100
Message-ID: <156-1267704663.20030514095404@jenitennison.com>
To: David.Pawson@rnib.org.uk
CC: public-qt-comments@w3.org

Hi Dave,

>> However, the need for this coding technique will greatly decline in
>> XSLT 2.0. It was used in XSLT 1.0 almost exclusively to handle
>> fixed look-up tables, which can be handled in XSLT 2.0 much more
>> efficiently using temporary trees held in global variables.
> The classic of 
> <months>
>  <January>
>  ...
> as a look up. 
> I can't see how a temporary tree will help there?

Rather than using the above (or the above with namespaces) as data
elements in your stylesheet and then doing something like:

  <xsl:value-of select="name(document('')/*/my:months/*[$monthNum])" />

you would declare a global variable:

<xsl:variable name="months">
  <January />

and then do:

  <xsl:value-of select="name($months/*[$monthNum])" />

Now that we don't have result tree fragments, defining a tree in a
variable (a temporary tree) and accessing information from that tree
is very easy.

Like Mike, I expect that this will be used in preference to the
document('') method as it's much less fiddly and works well across
multiple stylesheet modules.



Jeni Tennison
Received on Wednesday, 14 May 2003 04:54:15 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:12 UTC