Subject: Re: [xsl] Checking if a variable has a value From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 31 Aug 2022 11:10:24 -0000 |
>A variable always has a value.
I'm trying to reconcile this statement with Xquery, which I use more frequently.
In Xquery the following returns false:
let $x := () return B B B if (exists($x)) then true() else false()
Are you stating that the equivalent cannot happen in XSL variables? I'm asking this mostly because I've not had the need to explore this until now and am ignorant about it.
That variable $x does have a value, the value is the empty sequence. I think with most people trying to write some check for a null/undefined or non-existing variable value in XSLT/XQuery/XPath there is no clear definition of what kind of value a variable can have and for which kind of values to check.
As for an XQuery variable that might not be bound to a value, if you have e.g.
without providing a value for x, you will get (at least from Saxon) an error like "No value supplied for required parameter $x".
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Checking if a variable ha, Norm Tovey-Walsh ndw | Thread | Re: [xsl] Checking if a variable ha, John Lumley john@xxx |
Re: [xsl] Checking if a variable ha, Norm Tovey-Walsh ndw | Date | |
Month |