This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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



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>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]