W3C home > Mailing lists > Public > xproc-dev@w3.org > April 2010

RE: Catching parameters passed in

From: <Toman_Vojtech@emc.com>
Date: Fri, 16 Apr 2010 03:37:26 -0400
Message-ID: <997C307BEB90984EBE935699389EC41C0125EBFF@CORPUSMX70C.corp.emc.com>
To: <xproc-dev@w3.org>

If you know that you will only be passing a file type and file path,
then I think the best is to use options to your pipeline. If you use
options, you can then refer to them in your XPath expression using the
$opt syntax:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="myPipeline"
  <p:input port="source"/>
  <p:output port="result"/>
  <p:option name="file-type" required="true"/>
  <p:option name="file-path" required="true"/>

  <p:choose name="convertToPrepModel">
    <p:when test="... do something with $file-type and/or $file-path

However, if you want to support passing possibly any number of
parameters to your pipeline (with names that are not known in advance),
you will have to use a parameter input port:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="myPipeline"
  <p:input port="source"/>
  <p:input port="parameters" kind="parameter"/>
  <p:output port="result"/>

Working with parameters is a bit more difficult as you can't refer to
them directly in your XPath expressions. You would have to use steps
like p:parameters to construct a XML document that converts the
parameters to an XML document and then run your XPath expressions
against it.

Hope this helps,


Vojtech Toman
Principal Software Engineer
EMC Corporation
Received on Friday, 16 April 2010 07:38:16 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:06 UTC