[Top] [All Lists]

[xsl] Simple map and string-length(): unexpected behavior?

2019-06-07 19:52:27
Dear XSL list,

We are perplexed by a discrepancy between applying the string-length()
function directly to a numerical argument and using simple map to perform
what we expected would be the same operation. string-length(5) returns an
error, as expected. oXygen reports: "XPath failed due to: Required item
type of first argument of fn:string-length() is xs:string; supplied
expression (5) has item type xs:integer". eXist-db reports: "xs-integer(5)
is not a sub-type of xs-string".

When we use simple map, though, the behavior is different:

5 ! string-length() returns a string-length of 1

05 ! string-length() returns a string-length of 2

0.5 ! string-length() returns a string-length of 3

00.5 ! string-length returns a string-length of 3

05 ! string-length() returns a string-length of 1

Can someone please explain why simple-map does not raise the type error
that we see when we write the numerical argument directly inside the
function parentheses?

Thanks for your help!
Elisa Beshero-Bondar, PhD
Associate Professor of English
University of Pittsburgh at Greensburg
Humanities Division
150 Finoli Drive
Greensburg, PA  15601  USA
E-mail: ebb8(_at_)pitt(_dot_)edu
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
<Prev in Thread] Current Thread [Next in Thread>