This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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.
I believe this is covered by 19.2.2: Validation is not applied to temporary trees unless the document node is constructed using an xsl:document instruction. Similarly, validation is not applied to document nodes created using xsl:message. (This is equivalent to using validation="preserve": nodes within temporary trees retain their type annotation.) So I don't think that the problem you describe actually arises. I have to say it took me some time to find this, and it might be appropriate to mention it in section 9.4. - and perhaps to get rid of the brackets in the quoted paragraph! Michael Kay (personal response)
Editorial changes have been made as follows: (a) in the example in section 9.4 showing the equivalence to an explicit call of xsl:document, the xsl:document instruction now specifies validation="preserve". (b) an explanatory paragraph has been added in 9.4 to reinforce the statement already present in 19.2.2: No document-level validation takes place (which means, for example, that there is no checking that ID values are unique). However, type annotations on nodes within the new tree are copied unchanged. (c) the parentheses have been removed from the cited text in 19.2.2
SCA closed following 4 May Telcon where M. Kay text was accepted.