Bug 20876 - [XQX30] decimalFormatDecl
[XQX30] decimalFormatDecl
Status: CLOSED FIXED
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQueryX 3.0
Candidate Recommendation
PC Windows NT
: P2 normal
: ---
Assigned To: Jim Melton
Mailing list for public feedback on specs from XSL and XML Query WGs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-05 14:52 UTC by Tim Mills
Modified: 2013-11-19 00:17 UTC (History)
0 users

See Also:


Attachments

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:if>
    <xsl:text>declare </xsl:text>
    <xsl:if test="@xqx:default = 'true'">
      <xsl:text>default </xsl:text>
    </xsl:if>
    <xsl:text>decimal-format </xsl:text>
    <xsl:if test="xqx:decimalFormatName">
      <xsl:apply-templates select="xqx:decimalFormatName"/>
      <xsl:text> </xsl:text>
    </xsl:if>
    <xsl:apply-templates select="xqx:decimalFormatParam"/>
  </xsl:template>

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

  <xsd:complexType name="decimalFormatDeclType">
        <xsd:sequence>
          <xsd:element name="decimalFormatName" type="EQName" minOccurs="0"/>
          <xsd:element name="decimalFormatParam" minOccurs="0" maxOccurs="unbounded">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="decimalFormatParamName">
                  <xsd:simpleType>
                    <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:restriction>
                  </xsd:simpleType>
                </xsd:element>
                <xsd:element name="decimalFormatParamValue" type="xsd:string"/>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
  </xsd:complexType>

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.