W3C home > Mailing lists > Public > xsl-editors@w3.org > July to September 2000

Requirements for XSLT 1.1 (rtf/node set to boolean coercion)

From: David Carlisle <davidc@nag.co.uk>
Date: Tue, 29 Aug 2000 14:43:50 GMT
Message-Id: <200008291443.OAA29059@nag.co.uk>
To: xsl-list@mulberrytech.com
CC: xsl-editors@w3.org

Looks good!

One question/comment on result tree fragment/node set unification.

The new requirements document is worded so as to imply that the only
difference between rtf and node-set is the restriction of the allowed
operators.

I had thought that the other difference was coercion to boolean,

non-empty node sets always being true but non-empty rtf being false if
they have empty string value.

However perhaps my (and saxon's?) reading of the spec was faulty.

The xslt spec states that operations are allowed on rtf if they would
also be allowed on a string, but (I now see) it doesn't explicitly state
that the operation on the rtf actually proceeds by first coercing to the
string value of the rtf.

Given the stylesheet at the end of this message, applied to itself,
xt and xalan give

<?xml version="1.0" encoding="utf-8"?>

 a: 
 b: true
 c: 
 d: true
===

wheras saxon gives what I had previously thought to be the more correct
result,

<?xml version="1.0" encoding="utf-8" ?>
 a: 
 b: true
 c: 
 d: 
===


with $d being taken as false as it has empty string value.


If the node set/rtf distinction is to be dropped (which would be a good
thing:-) while maintaining the requirement that error free XSLT 1.0 stylesheets
MUST not have their behaviour changed, then the saxon (5.3.2)
interpretation is incorrect, or this behaviour is being classed as not
"fully specified" in XSLT 1.0. Would it be possible to clarify this
in the eventual 1.1 release,

David




<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
                >

<xsl:output method="xml" indent="yes"/>


<!-- empty node set -->
<xsl:variable name="a" select="document('')/aaa"/>

<!-- non empty node set (string value empty string) -->
<xsl:variable name="b" select="document('')/*/xsl:output"/>

<!-- empty string -->
<xsl:variable name="c"/>

<!-- non empty rtf with  (string value empty string) -->
<xsl:variable name="d">
 <x/>
</xsl:variable>

<xsl:template match="/">
 a: <xsl:if test="$a">true</xsl:if>
 b: <xsl:if test="$b">true</xsl:if>
 c: <xsl:if test="$c">true</xsl:if>
 d: <xsl:if test="$d">true</xsl:if>
===
</xsl:template>

</xsl:stylesheet>
Received on Tuesday, 29 August 2000 09:38:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:50 GMT