<?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>2549</bug_id>
          
          <creation_ts>2005-11-22 04:49:38 +0000</creation_ts>
          <short_desc>XQueryX Stylesheet fails to parenthesize predicate of if clause</short_desc>
          <delta_ts>2005-11-22 05:03:49 +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="Jim Melton">jim.melton</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>7257</commentid>
    <comment_count>0</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2005-11-22 04:49:38 +0000</bug_when>
    <thetext>(Submitted on behalf of Maxim Orgiyan)

For an ifClause of a conditional, the required parentheses are not output by the
stylesheet.
 
Here&apos;s an example XQuery expression:
 
if (fn:true()) then
    &lt;elem1/&gt;
else
    &lt;elem2/&gt;
 
When transforming the corresponding XQueryX document to XQuery with the
stylesheet, we get:
 
if fn:true() then
    &lt;elem1&gt;&lt;/elem1&gt;
else
    &lt;elem2&gt;&lt;/elem2&gt;
 
There should be () around fn:true(), as specified by XQuery grammar. 

Here&apos;s the sample XQueryX document:
 
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;xqueryx.xsl&quot;?&gt;
&lt;xqx:module xmlns:xqx=&quot;http://www.w3.org/2005/XQueryX&quot;
            xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
            xsi:schemaLocation=&quot;http://www.w3.org/2005/XQueryX xqueryx.xsd&quot;&gt;
  &lt;xqx:mainModule&gt;
    &lt;xqx:prolog&gt;
      &lt;xqx:varDecl&gt;
        &lt;xqx:varName&gt;input-context&lt;/xqx:varName&gt;
        &lt;xqx:external/&gt;
      &lt;/xqx:varDecl&gt;
    &lt;/xqx:prolog&gt;
    &lt;xqx:queryBody&gt;
      &lt;xqx:ifThenElseExpr&gt;
        &lt;xqx:ifClause&gt;
          &lt;xqx:pathExpr&gt;
            &lt;xqx:stepExpr&gt;
              &lt;xqx:filterExpr&gt;
                &lt;xqx:functionCallExpr&gt;
                  &lt;xqx:functionName xqx:prefix=&quot;fn&quot;&gt;true&lt;/xqx:functionName&gt;
                  &lt;xqx:arguments/&gt;
                &lt;/xqx:functionCallExpr&gt;
              &lt;/xqx:filterExpr&gt;            
            &lt;/xqx:stepExpr&gt;
          &lt;/xqx:pathExpr&gt;
        &lt;/xqx:ifClause&gt;
        &lt;xqx:thenClause&gt;
          &lt;xqx:pathExpr&gt;
            &lt;xqx:stepExpr&gt;
              &lt;xqx:filterExpr&gt;
                &lt;xqx:elementConstructor&gt;
                  &lt;xqx:tagName&gt;elem1&lt;/xqx:tagName&gt;
                  &lt;xqx:elementContent/&gt;
                &lt;/xqx:elementConstructor&gt;
              &lt;/xqx:filterExpr&gt;
            &lt;/xqx:stepExpr&gt;
          &lt;/xqx:pathExpr&gt;
        &lt;/xqx:thenClause&gt;
        &lt;xqx:elseClause&gt;
          &lt;xqx:pathExpr&gt;
            &lt;xqx:stepExpr&gt;
              &lt;xqx:filterExpr&gt;
                &lt;xqx:elementConstructor&gt;
                  &lt;xqx:tagName&gt;elem2&lt;/xqx:tagName&gt;
                  &lt;xqx:elementContent/&gt;
                &lt;/xqx:elementConstructor&gt;
              &lt;/xqx:filterExpr&gt;
            &lt;/xqx:stepExpr&gt;
          &lt;/xqx:pathExpr&gt;
        &lt;/xqx:elseClause&gt;
      &lt;/xqx:ifThenElseExpr&gt;
    &lt;/xqx:queryBody&gt;
  &lt;/xqx:mainModule&gt;
&lt;/xqx:module&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>7259</commentid>
    <comment_count>1</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2005-11-22 04:56:38 +0000</bug_when>
    <thetext>Thanks for reporting this error.  We will fix it in the sources immediately,
thus ensuring that it will be corrected in the next publication of XQueryX. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>7260</commentid>
    <comment_count>2</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2005-11-22 05:03:49 +0000</bug_when>
    <thetext>Thanks.  I am marking this bug CLOSED. </thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>