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

RE: Passing options from the command-line

From: Geert Josten <geert.josten@daidalos.nl>
Date: Sat, 27 Aug 2011 18:26:12 +0200
To: Florent Georges <fgeorges@fgeorges.org>, XProc Dev <xproc-dev@w3.org>
Message-ID: <B26C615F8546A84C81165A7BC8BE61A020F59EAA25@EXMBXC01.ms-hosting.nl>
Hi Florent,

Not entirely sure, but I think options should be specified from outside, or declared with some default. It should be possible to add a select="false()" to such options.

When test="$opt" is the kind of syntax I would have used in XSLT 1.0, but you might need to be more explicit with Calabash. I occasionally use expressions like: string-length($opt) > 0, or: (lower-case($opt) = ('1', 'y', 'yes', 'true'))..

Kind regards,
Geert

-----Oorspronkelijk bericht-----
Van: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] Namens Florent Georges
Verzonden: zaterdag 27 augustus 2011 16:47
Aan: XProc Dev
Onderwerp: Passing options from the command-line

  Hi,

  Given the following pipeline:

    <p:pipeline xmlns:p="http://www.w3.org/ns/xproc" version="1.0">

       <p:option name="opt"/>

       <p:choose>
          <p:when test="$opt">
             <p:identity>
                <p:input port="source">
                   <p:inline>
                      <when/>
                   </p:inline>
                </p:input>
             </p:identity>
          </p:when>
          <p:otherwise>
             <p:identity>
                <p:input port="source">
                   <p:inline>
                      <otherwise/>
                   </p:inline>
                </p:input>
             </p:identity>
          </p:otherwise>
       </p:choose>

    </p:pipeline>

I'd assume to get the following results:

  1/ if I evaluate it without passing any option explicitely,
     then the output would be <otherwise/>

  2/ if I evaluate it passing $opt as an empty string, then the
     output would be <otherwise/>

  3/ if I evaluate it passing any non-zero-length string for
     $opt, then the output would be <when/>

  But that's not what I observe with Calabash 0.9.33.  For 1/ it
complains $opt has not been declared, and for 3/ it still gives
me <otherwise/>.

  Did I make wrong assertions?

  Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
Received on Saturday, 27 August 2011 16:27:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 27 August 2011 16:27:10 GMT