[Bug 2549] XQueryX Stylesheet fails to parenthesize predicate of if clause

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2549

           Summary: XQueryX Stylesheet fails to parenthesize predicate of if
                    clause
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQueryX
        AssignedTo: jim.melton@acm.org
        ReportedBy: jim.melton@acm.org
         QAContact: public-qt-comments@w3.org


(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>

Received on Tuesday, 22 November 2005 04:49:49 UTC