W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2011

Re: Non-required options cannot be empty?

From: Florent Georges <fgeorges@fgeorges.org>
Date: Thu, 24 Nov 2011 17:46:31 +0100
Message-ID: <CADyR_r3eAh6sYHdd8m8Wr2z1vcVCvYcFF_0F07w7_zxLYpHGZw@mail.gmail.com>
To: Geert Josten <geert.josten@dayon.nl>
Cc: XProc Dev <xproc-dev@w3.org>
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 16:47:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 24 November 2011 16:47:20 GMT