- From: James Fuller <jim@webcomposite.com>
- Date: Tue, 18 Feb 2014 08:58:06 +0100
- To: Florent Georges <fgeorges@fgeorges.org>
- Cc: XProc Dev <xproc-dev@w3.org>
you could provide a default value to the option ( look up 5.7.2
p:option in http://www.w3.org/TR/xproc/#p.option)
<p:option name="o" required="false" select="()"/>
maybe this does not address your need, but thought I would mention it.
hth, Jim Fuller
On 18 February 2014 01:07, Florent Georges <fgeorges@fgeorges.org> wrote:
> 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 07:58:33 UTC