- From: <Toman_Vojtech@emc.com>
- Date: Wed, 21 Jul 2010 04:08:53 -0400
- To: <xproc-dev@w3.org>
> Is it possible to use the p:parameters in a p:variable? > > > <p:parameters name="params"> > <p:input port="parameters"> > <p:pipe step="run-pipe" port="par"/> > </p:input> > </p:parameters> > > <p:variable name="pipeline" > select="/c:param-set/c:param[@name='pipeline']/@value"> > <p:pipe step="params" port="result"/> > </p:variable> > > This causes this error. > > SEVERE: it is a static error for a variable's document connection to > refer to the output port of any step in the surrounding container's > contained steps > > > but if I wrap the p:variable in a p:group, with the usages of that > variable, then it works. Correct - p:variable is only allowed at the beginning of a sub-pipeline, before any steps. > Is there any other way of extracting a parameter from the p:parameters > pipe? If you want to store the parameter value in a variable, then I am afraid the answer is no. With some XProc implementations, you might be able to do just: <p:variable name="pipeline" select="/c:param-set/c:param[@name='pipeline']/@value"> <p:pipe step="params" port="result"/> </p:variable> But this approach only works with implementations that expose parameters as a single c:param-set document. With implementations that produce multiple c:param documents, or a mixture of c:param and c:param-set (which is also allowed), you would get a dynamic error because the XPath context would contain more than one item. So to be really sure, you need to process/wrap the parameters in some way first, for instance by using p:parameters, like you do above. But that requires the p:group wrapper after p:parameters. You could also write a step that has a parameter input port and that takes the name of the parameter as an option, and returns the value of the parameter as an XML document. But if you want to store the result of that step in a variable, you will need the p:group wrapper again... Regards, Vojtech -- Vojtech Toman Consultant Software Engineer EMC | Information Intelligence Group vojtech.toman@emc.com http://developer.emc.com/xmltech
Received on Wednesday, 21 July 2010 08:09:43 UTC