Bug 20876 - [XQX30] decimalFormatDecl
Summary: [XQX30] decimalFormatDecl
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQueryX 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Jim Melton
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
Depends on:
Reported: 2013-02-05 14:52 UTC by Tim Mills
Modified: 2013-11-19 00:17 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Tim Mills 2013-02-05 14:52:50 UTC
It's possible to define a decimalFormatDecl which is both the default (@default = 'true') and has a name.  This isn't possible in XQuery.  

I'd argue that the "default" attribute here is redundant.  Absence of the decimalFormatName is enough to indicate that it is the declaration for the default decimal format.
Comment 1 Jim Melton 2013-03-17 22:58:00 UTC
It is true that the XQueryX schema permits both a "name" child element and a "default" attribute with a value of 'true' to both be specified in the same decimalFormatDecl element.  However, any attempt to transform such a decimalFormatDecl element to XQuery syntax will generate an error:

  <xsl:template match="xqx:decimalFormatDecl">
    <xsl:if test="@xqx:default = 'true' and xqx:decimalFormatName">
      <xsl:message terminate="yes">Incorrect XQueryX: xqx:decimalFormatDecl does not allow both @default=true and xqx:decimalFormatName</xsl:message>
    <xsl:text>declare </xsl:text>
    <xsl:if test="@xqx:default = 'true'">
      <xsl:text>default </xsl:text>
    <xsl:text>decimal-format </xsl:text>
    <xsl:if test="xqx:decimalFormatName">
      <xsl:apply-templates select="xqx:decimalFormatName"/>
      <xsl:text> </xsl:text>
    <xsl:apply-templates select="xqx:decimalFormatParam"/>

Nonetheless, your point is taken and I have modified the XQueryX schema accordingly:

  <xsd:complexType name="decimalFormatDeclType">
          <xsd:element name="decimalFormatName" type="EQName" minOccurs="0"/>
          <xsd:element name="decimalFormatParam" minOccurs="0" maxOccurs="unbounded">
                <xsd:element name="decimalFormatParamName">
                    <xsd:restriction base="xsd:NMTOKEN">
                      <xsd:enumeration value="decimal-separator"/>
                      <xsd:enumeration value="grouping-separator"/>
                      <xsd:enumeration value="infinity"/>
                      <xsd:enumeration value="minus-sign"/>
                      <xsd:enumeration value="NaN"/>
                      <xsd:enumeration value="percent"/>
                      <xsd:enumeration value="per-mille"/>
                      <xsd:enumeration value="zero-digit"/>
                      <xsd:enumeration value="digit"/>
                      <xsd:enumeration value="pattern-separator"/>
                <xsd:element name="decimalFormatParamValue" type="xsd:string"/>

I've marked this bug RESOLVED/FIXED.  If you agree, please mark it CLOSED.
Comment 2 Tim Mills 2013-05-07 16:16:25 UTC
Thanks.  I'm happy that this resolves the problem.
Comment 3 Jim Melton 2013-11-19 00:17:06 UTC
The author of the original bug report agrees that it has been resolved to his satisfaction.  The fact that it was not marked CLOSED at the time was accidental, so I am marking it CLOSED now.