W3C home > Mailing lists > Public > xproc-dev@w3.org > March 2012

Re: XSLT-like command line parameter passing

From: Norman Walsh <ndw@nwalsh.com>
Date: Fri, 09 Mar 2012 07:06:43 -0500
To: XProc Dev <xproc-dev@w3.org>
Message-ID: <m2ipiec71o.fsf@nwalsh.com>
"Dr. Yves Forkl" <Y.Forkl@srz.de> writes:
> As far as I have understood, XProc has no global variables, but can
> pass parameters through its steps. However, I can't figure out how
> to access the parameter within an XPath expression when setting
> variable myvar in a step of my pipeline:

You can't. Well, not easily. The whole parameter situation is complex (and for
V.next there's serious thought being put into how to do it better). Basically,
parameter names are unknown to the pipeline.

You can get around this with the p:parameters step:

> <p:declare-step name="main" type="srz:pipeline1"
>   xmlns:p="http://www.w3.org/ns/xproc"
>   xmlns:srz="http://xmlns.srz.de/yforkl/xproc"
>   version="1.0">
>   <p:input port="source"/>
>   <p:output port="result" sequence="true"/>
>   <p:input port="parameters" kind="parameter"/>
>
>   ...
>
>   <p:declare-step name="step3" type="srz:step3">
>     <p:input port="source"/>
>     <p:output port="result" sequence="true">
>       <p:pipe step="store-each" port="result"/>
>     </p:output>
>     <p:input port="parameters" kind="parameter"/>
>
>     ...

      <p:parameters/>

      <p:variable name="myvar" select="/c:param-set/c:param[@name='myparam']/@value"/>

>     ...
>
>   </p:declare-step>
>
> ....
>   <srz:step3/>
>
> </p:declare-step>
>
> Do I need to read out <c:param-set> and parse its <c:param>
> children? Or what else am I missing?

Oh. You thought of that :-). Yes. 

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

Received on Friday, 9 March 2012 12:07:14 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 9 March 2012 12:07:15 GMT