Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6620287

The "format-number" function has an implementation-biased behaviour

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 6.0a
    • xml

      File numberformat25.xsl contains the following lines:
      <xsl:decimal-format decimal-separator="!" grouping-separator="!" />
      <out><xsl:value-of select="format-number(931.4857,'###!###!###')"/></out>
      The result of transformation is: <?...?><out>931</out>
      Since a parser implementation can consider that first ! in pattern is either decimal-separator or grouping-separator the result will be either 931 or 931.485.
      Thus the parser bahaviour is implementation-biased.

      The xsl:decimal-format element has a lot of attributes that control the format of result:
      <xsl:decimal-format
        name = qname
        decimal-separator = char
        grouping-separator = char
        infinity = string
        minus-sign = char
        NaN = string
        percent = char
        per-mille = char
        zero-digit = char
        digit = char
        pattern-separator = char />
      Since the order of handling isn't specified the result of transformation is implementation-biased if a parser does not control that all attributes has distinct characters.
      It makes sense to add a control and throw an exception like this: The same character is used as the grouping-separator and as the decimal-separator

            joehw Joe Wang
            lkuskov Leonid Kuskov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: