This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 2549 - XQueryX Stylesheet fails to parenthesize predicate of if clause
Summary: XQueryX Stylesheet fails to parenthesize predicate of if clause
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQueryX 1.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Jim Melton
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-22 04:49 UTC by Jim Melton
Modified: 2005-11-22 05:03 UTC (History)
0 users

See Also:


Attachments

Description Jim Melton 2005-11-22 04:49:38 UTC
(Submitted on behalf of Maxim Orgiyan)

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

Here's the sample XQueryX document:
 
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xqueryx.xsl"?>
<xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.w3.org/2005/XQueryX xqueryx.xsd">
  <xqx:mainModule>
    <xqx:prolog>
      <xqx:varDecl>
        <xqx:varName>input-context</xqx:varName>
        <xqx:external/>
      </xqx:varDecl>
    </xqx:prolog>
    <xqx:queryBody>
      <xqx:ifThenElseExpr>
        <xqx:ifClause>
          <xqx:pathExpr>
            <xqx:stepExpr>
              <xqx:filterExpr>
                <xqx:functionCallExpr>
                  <xqx:functionName xqx:prefix="fn">true</xqx:functionName>
                  <xqx:arguments/>
                </xqx:functionCallExpr>
              </xqx:filterExpr>            
            </xqx:stepExpr>
          </xqx:pathExpr>
        </xqx:ifClause>
        <xqx:thenClause>
          <xqx:pathExpr>
            <xqx:stepExpr>
              <xqx:filterExpr>
                <xqx:elementConstructor>
                  <xqx:tagName>elem1</xqx:tagName>
                  <xqx:elementContent/>
                </xqx:elementConstructor>
              </xqx:filterExpr>
            </xqx:stepExpr>
          </xqx:pathExpr>
        </xqx:thenClause>
        <xqx:elseClause>
          <xqx:pathExpr>
            <xqx:stepExpr>
              <xqx:filterExpr>
                <xqx:elementConstructor>
                  <xqx:tagName>elem2</xqx:tagName>
                  <xqx:elementContent/>
                </xqx:elementConstructor>
              </xqx:filterExpr>
            </xqx:stepExpr>
          </xqx:pathExpr>
        </xqx:elseClause>
      </xqx:ifThenElseExpr>
    </xqx:queryBody>
  </xqx:mainModule>
</xqx:module>
Comment 1 Jim Melton 2005-11-22 04:56:38 UTC
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. 
Comment 2 Jim Melton 2005-11-22 05:03:49 UTC
Thanks.  I am marking this bug CLOSED.