Re: Passing options from the command-line

Florent Georges <fgeorges@fgeorges.org> writes:
>   1/ if I evaluate it without passing any option explicitely,
>      then the output would be <otherwise/>

No. That'll give you an error because you're referring to a variable
with no value. If you want to test for that condition, use

  p:value-available('opt')

>   2/ if I evaluate it passing $opt as an empty string, then the
>      output would be <otherwise/>

Yes.

>   3/ if I evaluate it passing any non-zero-length string for
>      $opt, then the output would be <when/>

No. The result depends on the effective boolean value of the string.
So 'false' and possibly other values (I don't recall the EBV rules
for string off the top of my head) would give you <otherwise/>.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

Received on Saturday, 27 August 2011 18:23:13 UTC