- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Wed, 14 May 2003 09:54:04 +0100
- 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 />
  ...
</xsl:variable>
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.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 14 May 2003 04:54:15 UTC