Re: Passing options from the command-line

On 27 August 2011 20:22, Norman Walsh wrote:
> Florent Georges writes:

  Hi,

>>   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')

  Yes, thanks.  Btw the error message Calabash gives is
"empty-option.xproc:7:27:err:XD0023:Undeclared variable in XPath
expression: $opt".  Maybe the "undeclared" is not exactly right.

>>   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/>.

  Yes, I simplified a bit for the sake of conciseness.  But
nontheless, whatever string I pass (with an EBV of true()), I get
always <otherwise/> instead of <when/>, except with the exact
strings "true" and "1".  Weird...

  Thanks for your response!  Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/

Received on Sunday, 28 August 2011 21:15:44 UTC