format-number() applied to integer: too few leading zeroes
The Saxon XSLT and XQuery processor, developed by Saxonica
Brought to you by:
mhkay
When the argument of format-number is an integer, and
leading zeroes are required, too few leading zeroes are
added. For example, the result of format-number(1,
'00000') is "001".
The problem was reported on Saxon 8.5 but has been
present for a number of earlier releases.
Source fix: in
net.sf.saxon.functions.FormatNumber2.java, at line 621,
change:
for (int i=0; i < minWholePartSize - sb.length(); i++) {
sb.insert(0, '0');
}
to
int leadingZeroes = minWholePartSize - sb.length();
for (int i=0; i < leadingZeroes; i++) {
sb.insert(0, '0');
}
Michael Kay