Re: [xsl] XSLT 1.1 comments - the chocolate hobnob challenge

Subject: Re: [xsl] XSLT 1.1 comments - the chocolate hobnob challenge
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 16 Feb 2001 12:39:14 +0000
Francis Norton wrote:
> I think there is an pretty substantial requirement for extension
> functions that could be coded in XSLT - off the top of my head:
>         set functions (obviously we're using XSLT 1.1 RTF conversion to
> node-sets here):
>                 eg max(), min(), same-node() and various grouping functions 

I'm sure everyone's aware of this, but just to make a point about
manipulating node sets in XSLT templates.

   <xsl:variable name="foo">
      <xsl:copy-of select="bar" />

is not the same as:

   <xsl:variable name="foo" select="bar" />

A generated RTF that holds a copy of a node is different from the node
itself in several ways, some of which may be problematic when you come
to use it. In particular:

  * it has different relationships with other (ancestor and sibling) nodes
  * it has a different base URI
  * it has a different result for generate-id()

This isn't a problem for functions like max(), min() or even
same-node() because they don't return node sets, but if you're doing
intersection() or difference() then it does make a difference. Which
is why you need something like saxon:return to return node-set values
- it isn't enough to return RTFs, even if they can be treated as node
sets. To bring in another thread, it isn't enough to simply add syntax
sugar to the calling of named templates.

[I'm wondering whether I can turn the horrific XPath-parsing stuff I
did for XSLTDoc into some kind of XSLT-driven saxon:expression()...]



Jeni Tennison

 XSL-List info and archive:

Current Thread