W3C home > Mailing lists > Public > xproc-dev@w3.org > December 2009

RE: Difficulty overriding parameter values

From: <Toman_Vojtech@emc.com>
Date: Tue, 8 Dec 2009 07:20:11 -0500
Message-ID: <997C307BEB90984EBE935699389EC41C4F2EDC@CORPUSMX70C.corp.emc.com>
To: <xproc-dev@w3.org>
Hi Alex,
The p:pipe binding is necessary here because in this case, you want to
read the documents appearing on the "par" *parameter* port of the
pipeline. Without the p:pipe binding, the p:variable would be connected
to the "source" document input port of the pipeline.

From: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] On
Behalf Of Alex Muir
Sent: Tuesday, December 08, 2009 1:12 PM
To: Kevin Flynn
Cc: xproc-dev@w3.org
Subject: Re: Difficulty overriding parameter values

	Hi Kevin,
	I'm just getting a chance now to get your example running. It
has helped me out a tonne and I'm sure it will help others down the
	One thing that I don't understand is why <p:pipe step="pipe-abc"
port="par"/> needs to be inside the p:variable. What function does it
have in there?
	        <p:variable name="input-file"
	            <p:pipe step="pipe-abc" port="par"/>
	   <p:load name="load">
	            <p:with-option name="href" select="$input-file"/>
	Thanks Much
	On Fri, Nov 27, 2009 at 8:51 AM, Kevin Flynn <kevin@escenic.com>

		I received the following request from

		 I was looking over your posts at the following link
regarding Xproc and using and xml file
		 to drive the processing. I'm looking to do something
similar I was wondering if you could
		 share some solution on the xproc dev list to show how
you ended up solving what you were doing.
		So here goes:
		It's still a work in (intermittent) progress, but what I
currently do is use the http://www.w3.org/ns/xproc-step param-set
element for making configuration files. For example:
		<c:param-set xmlns:c="http://www.w3.org/ns/xproc-step">
		 <!-- run this pipeline... -->
		 <c:param name="pipeline" value="xyz"/>
		 <!-- with these parameters... -->
		 <c:param name="input-file"
		 <c:param name="output-file"
		 <c:param name="abc" value="def"/>
		A configuration file always contains one "master"
parameter, "pipeline" that names the actual pipeline to be run. All the
other parameters are the parameters required by that pipeline.
		This parameter file is submitted as the only input to a
master pipeline (called run-pipe.xpl) which just contains a big choose
element that runs the specified pipeline and passes on all the specified
		<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
		    <p:input port="source"/>
		    <p:input port="par" kind="parameter"/>
		    <!-- output port not needed, but this will output
the URL of the saved file -->
		    <p:output port="result">
		      <p:pipe step="end-of-pipe" port="result"/>
		 <p:import href="pipes.xpl"/>
		 <p:variable name="pipeline"
		  <p:pipe step="run-pipe" port="par"/>
		  <p:when test="$pipeline='abc'">
		    <pipes:abc name="abc">
		      <p:input port="par" kind="parameter">
		        <p:pipe step="run-pipe" port="par"/>
		  <!-- ...lots more "whens"... -->
		      <p:input port="source">
		          <ebd:message>Pipe not found</ebd:message>
		 <p:identity name="end-of-pipe"/>
		pipes.xpl contains all the actual pipelines, each of
which has the following basic structure:
		 <p:declare-step type="pipes:abc" name="pipe-abc">
		      <p:input port="source"/>
		      <p:input port="par" kind="parameter"/>
		      <p:output port="result">
		        <p:pipe step="store" port="result"/>
		  <p:import href="library.xpl"/>
		  <p:variable name="input-file"
		    <p:pipe step="pipe-abc" port="par"/>
		  <p:variable name="output-file"
		    <p:pipe step="pipe-abc" port="par"/>
		  <p:load name="load">
		    <p:with-option name="href" select="$input-file"/>
		  <lib:some-basic-pipe name="some-basic-pipe">
		    <p:input port="par" kind="parameter">
		      <p:pipe step="pipe-abc" port="par"/>
		  <!-- ...more pipes from library.xpl... -->
		  <p:store name="store">
		    <p:with-option name="href" select="$output-file"/>
		The pipelines in pipes.xpl extract the parameters they
need to "load" input files and "store" output files, and otherwise just
call a sequence of simpler pipelines from library.xpl.
		The pipelines in library.xpl are mostly just sequences
of xslt and other atomic steps:
		 <p:declare-step type="lib:some-basic-pipe"
		      <p:input port="source"/>
		      <p:input port="par" kind="parameter"/>
		      <p:output port="result">
		        <p:pipe step="trf2" port="result"/>
		    <p:xslt name="trf1">
		    <p:input port="stylesheet">
		        <p:document href="xsl/trf1.xsl"/>
		  <p:xslt name="trf2">
		    <p:input port="stylesheet">
		      <p:document href="xsl/trf2.xsl"/>
		All the parameters specified in the configuration file
are passed in to all the transformations, which can use the ones they
need. trf1.xsl, for example, might contain:
		  <xsl:param name="abc"/>
		and would therefore use the setting 'def' specified in
the configuration file.
		This structure means you can build up a library.xpl
containing basic pipes that can be re-used in various ways, and a
higher-level pipes.xpl that slots them together in more complex ways and
deals with reading and writing files. It's all accessible in a uniform
way - one pipe to call them all, plus a configuration file. Since I'm
using the standard http://www.w3.org/ns/xproc-step param-set element for
the configuration file, you can alternatively specify parameters on the
command line.
		In order to make this framework really useable, two
things are needed:
		- strict naming conventions for parameters
		- an automated means of exposing all the parameters used
by a particular pipeline.
		What I am thinking of doing is defining a standard way
of documenting all parameters, wherever they appear - in XSLT
transformations or pipes - most likely using a namespace. It would then
be possible to make an XSLT transformation that, given the name of one
of the top-level pipes in pipes.xpl, could drill down through all the
called sub-pipes and transformations, find all the parameters used and
generate a complete, fully-documented configuration file.
		Any advice, suggestions, offers of help etc. are more
than welcome.
		If this list is an inappropriate forum for this kind of
discussion (most posts seem to be focused on the specification, rather
than applications), maybe somebody can suggest an alternative?
		Kevin Flynn

Received on Tuesday, 8 December 2009 12:21:00 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:16:50 UTC