[Bug 3442] [XQueryX] Computed Processing Instruction Constructors

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

           Summary: [XQueryX] Computed Processing Instruction Constructors
           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: andrew.eisenberg@us.ibm.com
         QAContact: public-qt-comments@w3.org


There seems to be a small anomaly concering xqx:computedPIConstructor. The
schema allows the piValueExpr to be omitted:

  <xsd:complexType name="computedPIConstructor">
    <xsd:complexContent>
      <xsd:extension base="expr">
        <xsd:sequence>
          <xsd:choice>
            <xsd:element name="piTarget" type="xsd:NCName"/>
            <xsd:element name="piTargetExpr" type="exprWrapper"/>
          </xsd:choice>
          <xsd:element name="piValueExpr" type="exprWrapper" minOccurs="0"/>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

The stylesheet for xqx:computedPIConstructor, on the other hand, does not take
any special action when it is omitted:

  <xsl:template match="xqx:computedPIConstructor">
    <xsl:text> processing-instruction </xsl:text>
    <xsl:value-of select="xqx:piTarget"/>
    <xsl:apply-templates select="xqx:piTargetExpr"/>
    <xsl:apply-templates select="xqx:piValueExpr"/>
  </xsl:template>


This means that the following XQueryX document is accepted by the schema:

<?xml version="1.0"?>
<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
                                http://www.w3.org/2005/XQueryX/xqueryx.xsd">
  <xqx:mainModule>
    <xqx:queryBody>
      <xqx:elementConstructor>
        <xqx:tagName>elem</xqx:tagName>
        <xqx:elementContent>
          <xqx:computedPIConstructor>
            <xqx:piTarget>pi</xqx:piTarget>
          </xqx:computedPIConstructor>
        </xqx:elementContent>
      </xqx:elementConstructor>
    </xqx:queryBody>
  </xqx:mainModule>
</xqx:module>

The stylesheet transforms this into the following, which is not a valid XQuery:

<elem>{ processing-instruction pi}</elem>

Either the xqx:piValueExpr should be made mandatory, or the stylesheet should
generate an additional "{}" when it is omitted.

Received on Monday, 10 July 2006 15:48:35 UTC