[xsl] XSLT 2.0 and external parameters: a string -> xsd:integer. How?
Subject: [xsl] XSLT 2.0 and external parameters: a string -> xsd:integer. How? From: Andrew Watt <andrew@xxxxxxxxxxxxxx> Date: Tue, 20 May 2003 19:03:03 +0100
I guess this is another angle on the typing questions that have been
floating around the list recently.
Code that worked with Saxon 7.4 (and that I think would work in XSLT 1.0)
is now broken with Saxon 7.5.
How can I supply an external parameter to a Saxon 7.5 stylesheet which is
$number and has an integer value and get the XSLT processor to treat it as
an xsd:integer. Well, I don't particularly want the parameter to be
xsd:integer but I assume I won't be able to do anything numeric with it,
unless I make it explicitly numeric.
If I try to ignore types altogether Saxon 7.5 complains, not surprisingly,
that it cannot compare xsd:string to xsd:integer. If there is a way to
write a type-agnostic stylesheet to accept a parameter that is intended to
be numeric it isn't obvious to me at the moment.
So I made the input parameter xsd:string and created a new numeric
parameter using the xsd:integer() constructor function. Same error message.
Then I tried making the input parameter xdt:untypedAtomic with the
xsd:integer() constructor function to create the second parameter. Same
Then I tried adding an as="xsd:integer". Same error message.
The Saxon 7.5 documentation indicates that "most" such functions are
supported. Is this one unsupported or am I missing a basic trick somewhere?
I want to input a parameter at the command line, .... number=3 (which is
presumably a string at the point where it is bound to a global parameter
(which I have called $string), and later use that value (with $number
constructed using xsd:integer($string) ) as an xsd:integer.