<?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>1287</bug_id>
          
          <creation_ts>2005-05-03 10:16:24 +0000</creation_ts>
          <short_desc>pitest</short_desc>
          <delta_ts>2005-05-11 19:42:09 +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>XQueryX 1.0</component>
          <version>Last Call drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows 2000</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WORKSFORME</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="David Carlisle">davidc</reporter>
          <assigned_to name="Jim Melton">jim.melton</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>3589</commentid>
    <comment_count>0</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2005-05-03 10:16:24 +0000</bug_when>
    <thetext>The stylesheet has

    &lt;xsl:text&gt;processing-instruction&lt;/xsl:text&gt;
    &lt;xsl:value-of select=&quot;$LPAREN&quot;/&gt;
    &lt;xsl:value-of select=&quot;*&quot;/&gt;
    &lt;xsl:value-of select=&quot;$RPAREN&quot;/&gt;
  &lt;/xsl:template&gt;

value-of select=&quot;*&quot; will (in xslt1) silently discard all but the first node.

this looks a bit dangereous, but actually I wonder why the schema allows more
than one node here.

The Xquery grammar has



[89 (Core)]    	PITest 	   ::=
&lt;&quot;processing-instruction&quot; &quot;(&quot;&gt; (NCName | StringLiteral)? &quot;)&quot;

so 0-or-1 node that is NCName-or-String

However the XqueryX schema has



  &lt;xsd:element name=&quot;piTest&quot;&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:choice minOccurs=&quot;0&quot;&gt;
        &lt;xsd:element name=&quot;piTarget&quot; type=&quot;xsd:NCName&quot;/&gt;
        &lt;xsd:element name=&quot;piValue&quot; type=&quot;xsd:string&quot;/&gt;
      &lt;/xsd:choice&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

so any number of &quot;pitargets&quot; and &quot;pivalues&quot;. Shouldn&apos;t the schema be brought int
o line with the grammar, or, since the string version is explictly only there
for XPath1 compatibility, and equivalent to the use of an NCName, the XQueryX
version only really needs to model the child of pitest being 0-or-1 NCName.


David</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3450</commentid>
    <comment_count>1</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2005-05-10 23:20:08 +0000</bug_when>
    <thetext>In fact, the XQueryX schema as currently written does *NOT* allow more than one
node in the place you cite.  The relevant schema snippet (from your message) is:

  &lt;xsd:element name=&quot;piTest&quot;&gt;
    &lt;xsd:complexType&gt;
      &lt;xsd:choice minOccurs=&quot;0&quot;&gt;
        &lt;xsd:element name=&quot;piTarget&quot; type=&quot;xsd:NCName&quot;/&gt;
        &lt;xsd:element name=&quot;piValue&quot; type=&quot;xsd:string&quot;/&gt;
      &lt;/xsd:choice&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;

I believe that your concern stems from the fact that the &lt;xsd:choice&gt; element
has a minOccurs attribute, but no maxOccurs attribute.  It is a common error to
think that the absence of a maxOccurs attribute means &quot;any number of
occurrences&quot;.  In fact, according to XML Schema, section 3.3.2, XML
Representation of Element Declaration Schema Components
(http://www.w3.org/TR/xmlschema-1/#declare-element), the default value for
maxOccurs (when it is not specified) is 1. 

Therefore, we believe that this is not an error in the XQueryX specification. 
To avoid this sort of confusion in the future, we will add an explicit
maxOccurs=&quot;1&quot; attribute to such places (this harms nothing and has the advantage
of making the Schema more nearly self-documenting). </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3377</commentid>
    <comment_count>2</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2005-05-11 09:35:33 +0000</bug_when>
    <thetext>
&gt; we believe that this is not an error in the XQueryX specification. 

I agree. Sorry I was wrong: feel free to close this report as notabug or
whatever the category is.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3385</commentid>
    <comment_count>3</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2005-05-11 19:42:09 +0000</bug_when>
    <thetext>Thanks for your agreement with my initial response.  Based on your response, I
have changed the status to CLOSED. </thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>