<?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>2528</bug_id>
          
          <creation_ts>2005-11-16 00:09:11 +0000</creation_ts>
          <short_desc>[xqueryx]  check for node tests in xsl</short_desc>
          <delta_ts>2006-01-12 10:04:32 +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>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="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>7204</commentid>
    <comment_count>0</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2005-11-16 00:09:11 +0000</bug_when>
    <thetext>&lt;xsl:template match=&quot;xqx:functionCallExpr&quot;&gt;
    &lt;xsl:if test=&quot;xqx:functionName/@xqx:prefix&quot;&gt;
      &lt;xsl:value-of select=&quot;xqx:functionName/@xqx:prefix&quot;/&gt;
      &lt;xsl:value-of select=&quot;$COLON&quot;/&gt;
    &lt;/xsl:if&gt;
    &lt;xsl:if test=&quot;xqx:functionName = &apos;node&apos; or
                  xqx:functionName = &apos;document-node&apos; or
                  xqx:functionName = &apos;element&apos; or
                  xqx:functionName = &apos;attribute&apos; or
                  xqx:functionName = &apos;schema-element&apos; or
                  xqx:functionName = &apos;schema-attribute&apos; or
                  xqx:functionName = &apos;processing-instruction&apos; or
                  xqx:functionName = &apos;comment&apos; or
                  xqx:functionName = &apos;text&apos; or
                  xqx:functionName = &apos;item&apos; or
                  xqx:functionName = &apos;if&apos; or
                  xqx:functionName = &apos;typeswitch&apos; or
                  xqx:functionName = &apos;empty-sequence&apos;&quot;&gt;
      &lt;xsl:text&gt;fn:error()&lt;/xsl:text&gt;
    &lt;/xsl:if&gt;
    &lt;xsl:value-of select=&quot;xqx:functionName&quot;/&gt;


The check on &apos;node&apos; and friends needs to be moved into a branch that only
happens if there is no xqx:prefix. Currently the stylesheet rejects the xqx
version of the valid, executable XQuery


declare namespace x = &quot;x&quot;;
declare function x:text () {()};
x:text()
`

as it rejects any function with local name &quot;text&quot;.

The result of the stylesheet in this case also reveals a couple more problems


declare namespace x=&quot;x&quot;;
 declare function x:text()
{
()
};
x:fn:error()text()

The resulting Query does not include a call to fn:error() as intended as this is
mixed up with the function call that is being flagged as an error,and the result
is that the Query does not parse, which is a kind of error, but I don&apos;t think it
was as intended. It would be easy to arrange the template so that in the branch
that generates error() the original function nameand arguments were dropped
completely, although this would then still fail if fn: namespace has been
redeclared. It would be safer to generate the error message during the
transformation with an xsl:message terminate=&quot;yes&quot; rather than trying to cause
the generated query to always raise an error.



and for completeness the xqueryx version of the Xquery test shown above:

&lt;xqx:module xmlns:xqx=&quot;http://www.w3.org/2005/XQueryX&quot;&gt;
   &lt;xqx:mainModule&gt;
      &lt;xqx:prolog&gt;
         &lt;xqx:namespaceDecl&gt;
            &lt;xqx:prefix&gt;x&lt;/xqx:prefix&gt;
            &lt;xqx:uri&gt;x&lt;/xqx:uri&gt;
         &lt;/xqx:namespaceDecl&gt;
         &lt;xqx:functionDecl&gt;
            &lt;xqx:functionName xqx:prefix=&quot;x&quot;&gt;text&lt;/xqx:functionName&gt;
            &lt;xqx:paramList/&gt;
            &lt;xqx:functionBody&gt;
               &lt;xqx:sequenceExpr/&gt;
            &lt;/xqx:functionBody&gt;
         &lt;/xqx:functionDecl&gt;
      &lt;/xqx:prolog&gt;
      &lt;xqx:queryBody&gt;
         &lt;xqx:functionCallExpr&gt;
            &lt;xqx:functionName xqx:prefix=&quot;x&quot;&gt;text&lt;/xqx:functionName&gt;
            &lt;xqx:arguments/&gt;
         &lt;/xqx:functionCallExpr&gt;
      &lt;/xqx:queryBody&gt;
   &lt;/xqx:mainModule&gt;
&lt;/xqx:module&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>7541</commentid>
    <comment_count>1</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2005-12-25 00:47:51 +0000</bug_when>
    <thetext>Two very nice catches, indeed!

I will propose to the Working Groups that I be directed to modify the template
for xqx:functionCallExpr in the ways you suggested.  The proposal will be that
the template look something like this:

  &lt;xsl:template match=&quot;xqx:functionCallExpr&quot;&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test=&quot;xqx:functionName/@xqx:prefix&quot;&gt;
        &lt;xsl:value-of select=&quot;xqx:functionName/@xqx:prefix&quot;/&gt;
        &lt;xsl:value-of select=&quot;$COLON&quot;/&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:if test=&quot;xqx:functionName = &apos;node&apos; or
                      xqx:functionName = &apos;document-node&apos; or
                      xqx:functionName = &apos;element&apos; or
                      xqx:functionName = &apos;attribute&apos; or
                      xqx:functionName = &apos;schema-element&apos; or
                      xqx:functionName = &apos;schema-attribute&apos; or
                      xqx:functionName = &apos;processing-instruction&apos; or
                      xqx:functionName = &apos;comment&apos; or
                      xqx:functionName = &apos;text&apos; or
                      xqx:functionName = &apos;item&apos; or
                      xqx:functionName = &apos;if&apos; or
                      xqx:functionName = &apos;typeswitch&apos; or
                      xqx:functionName = &apos;empty-sequence&apos;&quot;&gt;
          &lt;xsl:variable name=&quot;message&quot;&gt;&lt;xsl:text&gt;Incorrect XQueryX: function
calls must not use unqualified &quot;reserved&quot; name &quot;&lt;/xsl:text&gt;&lt;xsl:value-of
select=&quot;xqx:functionName&quot;/&gt;&lt;xsl:text&gt;&quot;&lt;/xsl:text&gt;&lt;/xsl:variable&gt;
          &lt;xsl:message terminate=&quot;yes&quot;&gt;&lt;xsl:value-of
select=&quot;$message&quot;/&gt;&lt;/xsl:message&gt;
        &lt;/xsl:if&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
    &lt;xsl:value-of select=&quot;xqx:functionName&quot;/&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test=&quot;xqx:arguments&quot;&gt;
        &lt;xsl:for-each select=&quot;xqx:arguments&quot;&gt;
          &lt;xsl:call-template name=&quot;parenthesizedList&quot;/&gt;
        &lt;/xsl:for-each&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:value-of select=&quot;$LPAREN&quot;/&gt;
        &lt;xsl:value-of select=&quot;$RPAREN&quot;/&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
  &lt;/xsl:template&gt;

Your additional thoughts and comments on this proposed solution would be welcomed. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>7775</commentid>
    <comment_count>2</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2006-01-11 17:55:00 +0000</bug_when>
    <thetext>The XML Query WG has considered your comment and the response suggested in
additional comment #1, and has agreed to adopt the solution proposed in that
response as the resolution of your comment. 

This is the official WG response. 

Please let us know if you agree with this resolution of your issue, by adding a
comment to the issue record and changing the Status of the issue to Closed. Or,
if you do not agree with this resolution, please add a comment explaining why.
If you wish to appeal the WG&apos;s decision to the Director, then also change the
Status of the record to Reopened. If you wish to record your dissent, but do not
wish to appeal the decision to the Director, then change the Status of the
record to Closed. If we do not hear from you in the next two weeks, we will
assume you agree with the WG decision.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>7804</commentid>
    <comment_count>3</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2006-01-12 10:04:32 +0000</bug_when>
    <thetext>looks fine to me, thanks</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>