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 3442 - [XQueryX] Computed Processing Instruction Constructors
Summary: [XQueryX] Computed Processing Instruction Constructors
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: 2006-07-10 15:48 UTC by Andrew Eisenberg
Modified: 2006-07-31 15:18 UTC (History)
0 users

See Also:


Attachments

Description Andrew Eisenberg 2006-07-10 15:48:27 UTC
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.
Comment 1 Jim Melton 2006-07-28 21:56:16 UTC
Thanks for this bug report.  The XQueryX stylesheet has been revised so that the braces are output unconditionally instead of only when the XQueryX document specifies a value for the PI constructor.

Since this would appear to completely resolve your comment, you are requested to mark this bug CLOSED at your earliest convenience.