Re: [xsl] How to test whether boolean parameter has been set?

Subject: Re: [xsl] How to test whether boolean parameter has been set?
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 29 Oct 2018 09:29:50 -0000
Am 29.10.2018 um 10:08 schrieb Jorge . chocolate.camera@xxxxxxxxx:
> In XSLT2, how would you test whether a boolean global parameter 
> optionally empty
>
> B  B  <xsl:param name="THING" as="xs:boolean?"/>
>
> has been given a value at runtime?

The spec https://www.w3.org/TR/xslt-30/#element-param says "If a 
parameter that is notexplicitly mandatory 
<https://www.w3.org/TR/xslt-30/#dt-explicitly-mandatory>has noexplicit 
default <https://www.w3.org/TR/xslt-30/#dt-explicit-default>value, then 
it has an*implicit default*value, which is the empty sequence if there 
is an|as|attribute" so in your case you could check with 
https://www.w3.org/TR/xquery-operators/#func-empty
 B  empty($THING)
although that simply checks the value is the empty sequence, you can't 
tell whether the variable has that value as its implicit default value 
or because the empty sequence was set as the value externally when 
running the stylesheet.

Current Thread