<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>2945</bug_id>
          
          <creation_ts>2006-02-27 21:54:05 +0000</creation_ts>
          <short_desc>[XSLT] validated content in a variable</short_desc>
          <delta_ts>2006-05-09 14:21:47 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XSLT 2.0</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joanne Tong">joannet</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>8472</commentid>
    <comment_count>0</comment_count>
    <who name="Joanne Tong">joannet</who>
    <bug_when>2006-02-27 21:54:05 +0000</bug_when>
    <thetext>Consider this example:

&lt;xsl:stylesheet version=&quot;2.0&quot;
	xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; 
	xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;
	xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;

&lt;xsl:template match=&quot;/&quot;&gt;
	&lt;xsl:variable name=&quot;x&quot;&gt;
		&lt;xsl:document validation=&quot;strict&quot;&gt;
			...
			&lt;a xsi:type=&quot;xs:integer&quot;&gt;123&lt;/a&gt;
			...
		&lt;/xsl:document&gt;
	&lt;/xsl:variable&gt;
	&lt;xsl:value-of select=&quot;$x//a instance of xs:integer&quot; /&gt;
&lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;

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=&quot;preserve&quot; to the implicit document node.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>8522</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2006-03-02 19:15:47 +0000</bug_when>
    <thetext>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=&quot;preserve&quot;: nodes within temporary trees retain their type
annotation.)

So I don&apos;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)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9504</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2006-04-27 20:01:52 +0000</bug_when>
    <thetext>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=&quot;preserve&quot;.

(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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9709</commentid>
    <comment_count>3</comment_count>
    <who name="Sharon Adler">sca.w3c</who>
    <bug_when>2006-05-09 14:21:47 +0000</bug_when>
    <thetext>SCA closed following 4 May Telcon where M. Kay text was accepted.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>