- From: <bugzilla@wiggum.w3.org>
- Date: Mon, 27 Feb 2006 21:53:13 +0000
- To: public-qt-comments@w3.org
- Cc:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=2945
Summary: [XSLT] validated content in a variable
Product: XPath / XQuery / XSLT
Version: Candidate Recommendation
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: XSLT 2.0
AssignedTo: mike@saxonica.com
ReportedBy: joannet@ca.ibm.com
QAContact: public-qt-comments@w3.org
Consider this example:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:template match="/">
<xsl:variable name="x">
<xsl:document validation="strict">
...
<a xsi:type="xs:integer">123</a>
...
</xsl:document>
</xsl:variable>
<xsl:value-of select="$x//a instance of xs:integer" />
</xsl:template>
</xsl:stylesheet>
The user probably expects the content of variable x to be validated and the
xsl:value-of expression to return true. However, this is not the case because
an xsl:document is used implicitly to construct the temporary tree and default-
validation attribute is not specified in the xsl:stylesheet element. Thus,
all type information in variable x are stripped and the xsl:value-of
expression returns false. This would probably surprise most users since this
is not obvious from reading the sections on xsl:variable and validation. So I
suggest adding an example or a note in the specification to explain the
importance of specifying either the as attribute or the default-validation
attribute to preserve type information. The WG should also consider the
alternative to always preserve type information in a variable by adding
validation="preserve" to the implicit document node.
Received on Monday, 27 February 2006 21:53:20 UTC