RE: Use optional options...

Pity that the empty sequence is being downgraded to empty string in v1.

Will v2 by default initialize any (known but optional) option/param with
empty sequence?

Cheers

> -----Oorspronkelijk bericht-----
> Van: James Fuller [mailto:jim@webcomposite.com]
> Verzonden: dinsdag 18 februari 2014 8:58
> Aan: Florent Georges
> CC: XProc Dev
> Onderwerp: Re: Use optional options...
>
> 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 Wednesday, 19 February 2014 07:03:04 UTC