ACTION A-622-02: Josh Spiegel to propose changes to XQueryX

> ACTION A-622-02: Josh Spiegel to propose changes to XQueryX to support 
> new grammar for empty expressions in braces and return to group with a 
> proposal. 

The following XQuery productions were changed so that the enclosed expression is optional:

  CatchClause, 
  ValidateExpr, 
  OrderedExpr, 
  UnorderedExpr, 
  CompDocConstructor, 
  CompTextConstructor, 
  CompCommentConstructor,
  CompNamespaceConstructor

I looked at other expressions where the enclosed expression is already optional:

  In computedAttributeConstructor, valueExpr is optional.
  In computedPIConstructor, piValueExpr is optional.
  In computedElementConstructor, contentExpr is optional.
  In extensionExpr, argExpr is optional.

So I think the following XQueryX changes are appropriate:  

  - Make argExpr optional in: 

      computedCommentConstructor, 
      computedDocumentConstructor,  	
      unorderedExpr,
      orderedExpr,
      validateExpr

  - Make catchExpr optional in catchClause
  - Make tryClause optional in tryCatchExpr

  (argExpr is already optional in computedTextConstructor)
  (uriExpr is already optional in computedNamespaceConstructor)

I don't think any changes to the stylesheet are necessary.


That should cover optional enclosed expressions.  However, the string constructor was recently added and I think we need to add an element to the XQueryX schema:

 <xsd:complexType name="stringConstructor">
   <xsd:complexContent>
     <xsd:extension base="expr">
       <xsd:sequence>
         <xsd:choice minOccurs="0" maxOccurs="unbounded">
           <xsd:element name="stringConstructorChars" type="xsd:string"/>
           <xsd:element name="stringConstructorInterpolation" type="exprWrapper"/>
         </xsd:choice>
       </xsd:sequence>
     </xsd:extension>
   </xsd:complexContent>
 </xsd:complexType>

 <xsd:element name="stringConstructor" type="stringConstructor" substitutionGroup="expr"/>

And we will also need to update the XQueryX stylesheet:

 <xsl:template match="xqx:stringConstructor">
   <xsl:text>``[</xsl:text>
   <xsl:apply-templates/>
   <xsl:text>]``</xsl:text>
 </xsl:template>

 <xsl:template match="xqx:stringConstructorInterpolation">
   <xsl:text>`{</xsl:text>
   <xsl:apply-templates/>
   <xsl:text>}`</xsl:text>
 </xsl:template>

 <xsl:template match="xqx:stringConstructorChars">
   <xsl:value-of select="."/>
 </xsl:template>

I have applied these changes to a local copy of the specification (diffs attached).

Thanks,
Josh

Received on Monday, 14 December 2015 15:17:45 UTC