Implementation of "str:align" seems to be wrong
"Karr, David" <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
I'm stepping through the regression tests for EXSLT functions. I was looking at the "str:align" function. The Xalan-native implementation, and the implementation in the EXSLT library, seem to be slightly wrong. >From how I understand what the function should do, it essentially superimposes the target string on top of the padding string. The resulting string length should be the max of the target and padding string lengths. In the "left" case, the following is directly from the implementation: <func:result select="concat($string, substring($padding, $str-length + 1))" /> This concatenates the target string with the padding, taking the length of the padding string as the length of the TARGET string. Therefore, if the target string is length 21 and the padding is length 30, the resulting string will be length 42, instead of 30, as I believe it should be. I guess this line should actually be (guessing): <func:result select="concat($string,substring($padding,($pad-length - $str-length)))"/>