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 16:47:19 UTC