Use optional options...

  Hi,

  If I pass an optional option to a step, and if I want to use the
value of the parameter, without any error because that parameter does
not exist, I would like to declare the following variable (to default
the value of the option in case it has not been provided, and to
prevent static errors), but even in that case it is an error because
the variable is referenced in the XPath expression, so it is a static
error:

    <p:option name="o" required="false"/>

    <p:variable name="v" select="
       if ( p:value-available('o') ) then
          $o
       else
          'default value'"/>

    <!-- here, can use $v everywhere... -->

  Is there an idiomatic solution to this problem?  I mean, besides
using a p:choose around all possible step using the option?

  Regards,

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

Received on Tuesday, 18 February 2014 00:07:58 UTC