Re: Variables and parameters

Hi,

Norm Walsh wrote:
> Optionally, parameters can specify the document that should be the
> context node for evaluation:
> 
>     <p:param name="destination" ref="somelabel" select="/*/@label"/>

A more flexible alternative would be to say that labelled documents are 
referencable as variables within the XPath expressions used to set 
parameters or variables. The above would be:

<p:param name="destination" select="$somelabel/*/@label" />

This is more flexible because it means that you can refer to more than 
one document within the XPath expression.

If we did this when setting parameters then we might want the symmetry 
of doing it with inputs and outputs. Something like:

<p:pipeline name="my:process">
   <p:input name="input" label="pipeline.input" />

   <p:step name="xinclude">
     <p:input name="input" select="$pipeline.input" />
     <p:output name="output" label="included.output" />
   </p:step>
   <p:step name="xslt">
     <p:input name="input" select="$included.output" />
     <p:input name="stylesheet" href="style.xsl" />
     <p:output name="output" label="xslt.output" />
   </p:step>

   <p:output name="output" select="$xslt.output" />
</p:pipeline>

Note that in the above I've retained the syntax that we've been using 
for <p:input> and <p:output> -- giving the ports unique names via the 
label attribute -- but that if we wanted to have symmetry with 
parameters and variables, we might want to change that syntax. For 
example, we could have a port attribute to give the name of the port and 
a name attribute to give the name of the variable to which the document 
is assigned within the pipeline:

<p:pipeline name="my:process">
   <p:input port="input" name="pipeline.input" />

   <p:step name="xinclude">
     <p:input port="input" select="$pipeline.input" />
     <p:output port="output" name="included.output" />
   </p:step>
   <p:step name="xslt">
     <p:input port="input" select="$included.output" />
     <p:input port="stylesheet" href="style.xsl" />
     <p:output port="output" name="xslt.output" />
   </p:step>

   <p:output port="output" select="$xslt.output" />
</p:pipeline>

Cheers,

Jeni
-- 
Jeni Tennison
http://www.jenitennison.com

Received on Friday, 12 May 2006 11:47:04 UTC