Re: Variables and parameters

Hi Alessandro,

Alessandro Vernet wrote:
> On 5/22/06, Jeni Tennison <jeni@jenitennison.com> wrote:
>>    The select attribute of p:param, p:variable, p:step/p:input and
>>    p:pipeline/p:output holds an XPath expression that provides the value
>>    of the parameter, variable, input or output. [...]
> 
> What you suggest here seems quite elegant to me. It is at the same
> time simple and powerful. So putting some of those things together,
> let's consider an example:
> 
> <p:pipeline xmlns:p="http://www.w3.org/2006/XProc/Pipeline">
>     
>     <p:input name="request"/>
>     <p:output name="response" select="$result"/>
> 
>     <p:variable name="has-namespaces"
>         select="count(/*/namespace::*) > 0"/>
>     
>     <p:step name="validate">
>         <p:with-input name="schema" href="my-schema.xsd"/>
>         <p:with-input name="document" select="$request"/>
>         <p:with-param name="do-namespace-processing"
>             select="$has-namespaces"/>
>         <p:with-output name="name" label="validity"/>
>     </p:step>
> 
>     <p:choose>
>         <p:when test="$validity = 'true'">
>             <p:step name="process-request">
>                 <p:with-input name="document" select="$request"/>
>                 <p:with-output name="result" label="result"/>
>             </p:step>
>         </p:when>
>         <p:otherwise>
>             <p:step name="return-error">
>                 <p:with-output name="error" label="result"/>
>             </p:step>
>         </p:otherwise>
>     </p:choose>
>     
> </p:pipeline>
> 
> Are we on the same line?

Yep, although the p:pipeline/p:output needs to go at the end, after the 
steps, so that it can refer to variables set higher up.

Cheers,

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

Received on Wednesday, 24 May 2006 07:55:50 UTC