- From: Geert Josten <geert.josten@dayon.nl>
- Date: Thu, 24 Nov 2011 18:02:42 +0100
- To: Florent Georges <fgeorges@fgeorges.org>
- Cc: XProc Dev <xproc-dev@w3.org>
Yeah, was afraid someone was going to mention that. But how about 4
non-required option? I would have to consider 24 possible combinations..
It would help a lot if XMLCalabash would recognize that the option is
declared and therefore known, but 'simply' hasn't any value..
:-/
-----Oorspronkelijk bericht-----
Van: fgeorges@gmail.com [mailto:fgeorges@gmail.com] Namens Florent Georges
Verzonden: donderdag 24 november 2011 17:47
Aan: Geert Josten
CC: XProc Dev
Onderwerp: Re: Non-required options cannot be empty?
On 24 November 2011 17:15, Geert Josten wrote:
> But when I try to access the options in an expression later on,
> without having supplied a value from outside, XMLCalabash complains
> it doesn't know the option at all.
That's what p:value-available() is for. For instance:
<p:pipeline xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:my="my..."
version="1.0">
<p:declare-step type="my:step">
<p:input port="source" primary="true"/>
<p:output port="result" primary="true"/>
<p:option name="dummy"/>
<p:choose>
<p:when test="p:value-available('dummy')">
<p:identity>
<p:input port="source">
<p:inline>
<dummy/>
</p:inline>
</p:input>
</p:identity>
</p:when>
<p:otherwise>
<p:identity/>
</p:otherwise>
</p:choose>
</p:declare-step>
<my:step/>
<!-- or -->
<!--my:step dummy="hello"/-->
</p:pipeline>
Regards,
--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
Received on Thursday, 24 November 2011 17:03:32 UTC