Skip to content

Commit

Permalink
Merge pull request #1638 from michaelhkay/1634-decimal-format-properties
Browse files Browse the repository at this point in the history
1634 Update description of decimal properties in the static context
  • Loading branch information
ndw authored Dec 17, 2024
2 parents c7359e4 + a079d63 commit b608b32
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 31 deletions.
84 changes: 54 additions & 30 deletions specifications/xquery-40/src/expressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1116,28 +1116,45 @@ constructor, as described in <specref
function, and also specify characters to be used in the result
of formatting the number.</p>

<p>The following properties specify characters used both in the picture string, and in the formatted number. In each case the value is a single character:</p>
<p>Each property potentially has two parts: a marker character <var>M</var> used
in the picture string to mark an insertion position, and a rendition string <var>R</var>
to indicate how the relevant property is to be rendered in the output of the
<code>fn:format-number</code> function. In the list below properties are annotated
with <emph>(<var>M</var>)</emph>, <emph>(<var>R</var>)</emph>, or
<emph>(<var>M</var>, <var>R</var>)</emph> to indicate whether the property includes a
marker character, a rendition string, or both.</p>

<p>In XQuery and XSLT declarations
defining the values of properties, a property where the marker character and the
rendition differ is indicated using the syntax <code><var>M</var>:<var>R</var></code>. For
example the <code>percent</code> property may be expressed as <code>%:pc</code>
to indicate that the character <code>%</code> will be used in the picture string,
and the string <code>pc</code> will be used in the function output.
In this example, the value <code>0.10</code>, formatted with the picture string
<code>#0%</code>, results in the output <code>10pc</code></p>


<ulist>
<item>
<p>
<termdef id="id-static-decimal-format-decimal-separator"
term="decimal-separator">
<term>decimal-separator</term> is
the character used to separate the integer part of the number from the fractional part, both in the picture
string and in the formatted number; the default
value is <char>U+002E</char>.</termdef>
<term>decimal-separator</term>
<emph>(<var>M</var>, <var>R</var>)</emph> is
used to separate the integer part of the number from the fractional part.
The default value for both the marker and the rendition is <char>U+002E</char>.</termdef>
</p>
</item>

<item>
<p>
<termdef id="id-static-decimal-format-exponent-separator"
term="exponent-separator">
<term>exponent-separator</term> is
the character used to separate the mantissa from the exponent in
scientific notation both in the picture string and in the
formatted number; the default value is <char>U+0065</char>.</termdef>
<term>exponent-separator</term>
<emph>(<var>M</var>, <var>R</var>)</emph> is
used to separate the mantissa from the exponent in
scientific notation. The default value
for both the marker and the rendition is <char>U+0065</char>.</termdef>
</p>
</item>

Expand All @@ -1146,40 +1163,43 @@ constructor, as described in <specref
<termdef id="id-static-decimal-format-grouping-separator"
term="grouping-separator">
<term>grouping-separator</term>
is the character typically used as a thousands separator, both in the picture string
and in the formatted number; the default value is <char>U+002C</char>.</termdef>
<emph>(<var>M</var>, <var>R</var>)</emph> is used to
separate groups of digits (for example as a thousands separator).
The default value for both the marker and the rendition is <char>U+002C</char>.</termdef>
</p>
</item>

<item>
<p>
<termdef id="id-static-decimal-format-percent" term="percent">
<term>percent</term>
is the character used both in the picture string and in the formatted number to
<emph>(<var>M</var>, <var>R</var>)</emph> is used to
indicate that the number is written as a per-hundred fraction; the default
value is <char>U+0025</char>.</termdef>
value for both the marker and the rendition is <char>U+0025</char>.</termdef>
</p>
</item>

<item>
<p>
<termdef id="id-static-decimal-format-per-mille" term="per-mille">
<term>per-mille</term>
is the character used both in the picture string and in the formatted number to indicate that the number is written as a per-thousand fraction; the default
value is <char>U+2030</char>.</termdef>
<emph>(<var>M</var>, <var>R</var>)</emph> is used to
indicate that the number is written as a per-thousand fraction; the default
value for both the marker and the rendition is <char>U+2030</char>.</termdef>
</p>
</item>

<item>
<p>
<termdef id="id-static-decimal-format-zero-digit" term="zero-digit">
<term>zero-digit</term>
is the character used to represent the digit zero; the default
<emph>(<var>M</var>)</emph>
is the character used in the picture string to represent the digit zero; the default
value is <char>U+0030</char>. This character must be a digit
(category Nd in the Unicode property database), and it must have
the numeric value zero. This property implicitly defines the
ten Unicode characters that are used to represent the values 0
to 9: Unicode is organized so that each
to 9 in the function output: Unicode is organized so that each
set of decimal digits forms a contiguous block of characters in
numerical sequence. Within the picture string any of these ten character
can be used (interchangeably) as a place-holder for a mandatory digit.
Expand All @@ -1188,7 +1208,7 @@ constructor, as described in <specref
</p>
</item>

</ulist>
<!--</ulist>

<p>In the case of the the properties <termref def="id-static-decimal-format-decimal-separator"/>,
<termref def="id-static-decimal-format-grouping-separator"/>,
Expand All @@ -1197,22 +1217,20 @@ constructor, as described in <specref
and <termref def="id-static-decimal-format-per-mille"/>, the property may take the form
<code>m:r</code>, where <code>m</code> is a single-character marker used in the picture
string to indicate where the relevant output should appear, and <code>r</code> is the
string used to represent the property in the result. For example, setting the
<termref def="id-static-decimal-format-percent"/> property to <code>"%:pc"</code>
means that the value <code>0.10</code>, formatted with the picture string
<code>#0%</code>, results in the output <code>10pc</code>.
string used to represent the property in the result. .
</p>

<p>The following properties specify
characters to be used in the picture string supplied to the <function>fn:format-number</function>
function, but not in the formatted number. In each case the value must be a single character.
</p>

<ulist>
<ulist>-->
<item>
<p>
<termdef id="id-static-decimal-format-digit" term="digit">
<term>digit</term>
<term>digit</term>
<emph>(<var>M</var>)</emph>
is a character used in the picture string to represent an optional digit;
the default value is <char>U+0023</char>.</termdef>
</p>
Expand All @@ -1222,37 +1240,43 @@ constructor, as described in <specref
<p>
<termdef id="id-static-decimal-format-pattern-separator"
term="pattern-separator">
<term>pattern-separator</term> is a character used
<term>pattern-separator</term>
<emph>(<var>M</var>)</emph> is a character used
to separate positive and negative sub-pictures
in a picture string; the default value is <char>U+003B</char>.</termdef>
</p>
</item>
</ulist>
<!-- </ulist>

<p>The following properties specify characters or strings that
may appear in the result of formatting the number, but not in the picture string:</p>

<ulist>
<ulist>-->
<item>
<p>
<termdef id="id-static-decimal-format-infinity" term="infinity">
<term>infinity</term> is the string used to represent the double value infinity (<code>INF</code>); the
<term>infinity</term>
<emph>(<var>R</var>)</emph>
is the string used to represent the double value infinity (<code>INF</code>); the
default value is the string <code>"Infinity"</code></termdef>
</p>
</item>

<item>
<p>
<termdef id="id-static-decimal-format-NaN" term="NaN">
<term>NaN</term> is the string used to
<term>NaN</term>
<emph>(<var>R</var>)</emph>
is the string used to
represent the double value <code>NaN</code> (not a number); the default value is the string <code>"NaN"</code></termdef>
</p>
</item>

<item>
<p>
<termdef id="id-static-decimal-format-minus-sign" term="minus-sign">
<term>minus-sign</term> is the single character used to mark negative numbers; the
<term>minus-sign</term>
<emph>(<var>R</var>)</emph> is the string used to mark negative numbers; the
default value is <char>U+002D</char>.</termdef>
</p>
</item>
Expand Down
2 changes: 1 addition & 1 deletion specifications/xslt-40/src/xslt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11368,7 +11368,7 @@ and <code>version="1.0"</code> otherwise.</p>
</item>
<item>
<p>
<code>minus-sign</code> specifies the string used to represent a negative
<code>minus-sign</code> specifies the string used to indicate a negative
number; the default value is <char>U+002D</char>.</p>
</item>
</ulist>
Expand Down

0 comments on commit b608b32

Please sign in to comment.