Re: [xsl] exsl:node-set and Saxon 6.5.5

Subject: Re: [xsl] exsl:node-set and Saxon 6.5.5
From: "Manfred Staudinger" <manfred.staudinger@xxxxxxxxx>
Date: Thu, 22 Feb 2007 18:41:38 +0100
Ah, now I remember to have read some time ago about
"extension functions are allowed to have side-effects".

The references I found useful
2002-05-18 http://lists.fourthought.com/pipermail/exslt/2002-May/000468.html
2002-11-12 http://www.exslt.org/exsl/functions/node-set/

Thanks for your explanations.

Manfred

On 22/02/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
The implementation of exsl:node-set() in Saxon 6.x is a bit of a hack. A
result tree fragment in Saxon 6.x is a document node, with a special bit set
to say "I am a result tree fragment": this bit artifically disables
operations such as "/" applied to the document node. The effect of
exsl:node-set() is to unset this bit in situ, thus enabling such operations.
A bit dirty, but the XSLT spec allows extension functions to do anything you
like, so it's not technically non-conformant.

Michael Kay
http://www.saxonica.com/


> -----Original Message----- > From: Manfred Staudinger [mailto:manfred.staudinger@xxxxxxxxx] > Sent: 21 February 2007 22:21 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] exsl:node-set and Saxon 6.5.5 > > Hi All, > > As I rely heavily on the superb diagnostics of Saxon when > testing client-side (browser) XSLT 1.0 I would like to > understand the following. > > When I run the stylesheet below with SAXON 6.5.5 (with two > <xsl:copy-of statements) then the (unexpected) output is > > <?xml version="1.0" encoding="utf-8"?> > <test> > <Title>From exsl:node-set($rtf)/a/b:</Title> > <b> > <c> > <d/> > </c> > </b> > <Title>Directly from $rtf/a/b/c:</Title> > <c> > <d/> > </c> > </test> > > However, if I delete the first <xsl:copy-of then I get this > error message from the other one > To use a result tree fragment in a path expression, either > use exsl:node-set() or specify version='1.1' > as I think correctly. > > Did I miss something XSLT-wise ? > > Regards, Manfred > > <?xml version="1.0" encoding="UTF-8" ?> > <xsl:stylesheet version="1.0" > xmlns:exsl="http://exslt.org/common"; > exclude-result-prefixes="exsl" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform";> > <xsl:output indent="yes"/> > > <xsl:template match="/"> > <xsl:variable name="rtf"> > <a> > <b> > <c> > <d /> > </c> > </b> > </a> > </xsl:variable> > <test> > <Title><xsl:text>From > exsl:node-set($rtf)/a/b:</xsl:text></Title> > <xsl:copy-of select="exsl:node-set($rtf)/a/b"/> > <Title><xsl:text>Directly from > $rtf/a/b/c:</xsl:text></Title> > <xsl:copy-of select="$rtf/a/b/c"/> > </test> > </xsl:template> > </xsl:stylesheet>

Current Thread