[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] What the default datatype of an stylesheet parameter ?


Subject: Re: [xsl] What the default datatype of an stylesheet parameter ?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Nov 2011 18:31:58 -0500

At 2011-11-24 21:19 +0100, Matthieu Ricaud-Dussarget wrote:
When sending a parameter to the stylesheet( from command line with saxon for example), I thought it was always a string (which is a pitty when you need boolean parameter).

I made a simple test, sending "bar" to parameter foo :
<xsl:param name="foo"/>

In XSLT 1, that is, indeed, an empty string as you anticipated. In XSLT 2, however, that is the declaration of an empty sequence.


I was really astonished to see that
$foo instance of xs:string
returns false()

I then typed the parameter :
<xsl:param name="foo" as="xs:string"/>
and got true()

What was the type of $foo before I casted it with as="xs:string" ?
Has it any type ...?

Nope. It is bound to the empty sequence and cannot be changed if a binding value is not supplied at invocation time.


Thank for your lightening me :-)

I hope this helps.


. . . . . . . . . . . . Ken


-- Contact us for world-wide XML consulting and instructor-led training Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/t37DVX Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal


Current Thread
Keywords