- From: James Sulak <jsulak@gmail.com>
- Date: Mon, 25 May 2009 11:07:53 -0500
- To: Dave Pawson <dave.pawson@gmail.com>
- Cc: xproc-dev@w3.org
I like what Vojtech suggested (using an external c:param-set document). No need to reinvent the wheel like I did. But the problem remains of how to assign them to variables so you can access them in non-xslt steps. You can explicitly assign them, like Vojtech said, using the p:parameters step: <p:variable name="output_folder" select="//c:param[@name='output_folder']/@value"> <p:pipe port="parameters" step="pipeline"/> </p:variable> But that gets clunky fast if you have a lot of options you want to assign. The proposed exproc config schema suggests the following: <pxpc:xproc-config> <pxpc:with-option name="output_folder" value="/home/jsulak/output" /> <pxpc:with-option name="stylesheet" value="docbook-xproc-introduction.xslt" /> </pxpc:xproc-config> Which is an alternative to passing command-line options to an xproc processor. Digging around calabash, it looks like Norm uses basically the same schema with a different namespace (http://svn.xmlcalabash.com/calabash/schemas/configuration.rnc). But the following pipeline fails, saying that I have not specified a value for the required option: <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="pipeline"> <p:input port="source" primary="true" sequence="true"> <p:inline> <foo/> </p:inline> </p:input> <p:output port="result" primary="true" sequence="true" /> <p:option name="new-name" required="true" /> <p:rename match="/foo"> <p:with-option name="new-name" select="$new-name" /> </p:rename> </p:declare-step> with the following option document (options.xml): <xproc-config xmlns:cc="http://com.xmlcalabash/ns/configuration"> <cc:with-option name="new-name" value="bar" /> </xproc-config> with the following command line parameters: calabash -c options.xml pipeline.xpl Norm, am I doing something wrong here? I think is what Dave really wants (correct me if I'm wrong). I hadn't really thought of it until Dave brought it up, but having this sort of options file, like an Ant properties file, would be incredibly useful for making configurable pipelines. Almost essential for certain applications. It really needs to be done with options or variables; parameters sets are only immediately useful for XSLT and similar steps (without jumping through additional hoops to turn them into variables or refer to them through XPath). So I hope that that exproc configuration schema gets widely adopted. -James On Mon, May 25, 2009 at 3:11 AM, Dave Pawson <dave.pawson@gmail.com> wrote: > 2009/5/25 <Toman_Vojtech@emc.com>: > >> My example pipeline had only one parameter input port, but you can have as many you want in your pipelines. > > Nice! > >>> Next question, how do I refer to the values set in >>> the external file? Is there some syntax for this? >>> >>> E.g. I want to run an XSLT transform using >>> parameter $xslt_stylesheet as the stylesheet for the transform. >> >> I think you have to use p:parameters to read the parameters document first. Then you can apply XPath expressions to the generated c:param-set document and use the results in, for instance, XProc variables or options, or in choose/when statements. > > Not so nice :-( > > No lessons learned from xslt? $param-name to get the value? > > > regards > > > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ. > http://www.dpawson.co.uk > >
Received on Monday, 25 May 2009 16:08:38 UTC