Re: p:choose with no default

Hi,

As far as I know, the idea is to guarantee that the signature of the  
p:choose is consistent regardless of what subpipeline is dynamically  
selected.

 From the spec: "in order to ensure that the output of the p:choose is  
consistent irrespective of the subpipeline chosen, each subpipeline  
must declare the same number of outputs with the same names. If any of  
the subpipelines specifies a primary output port, each subpipeline  
must specify exactly the same output as primary. It is astatic error  
(err:XS0007) if two subpipelines in a p:choose declare different  
outputs."

In your case it depends on the signature of the cstep:create- 
dedication step, but in case it has no output ports, I suppose you can  
declare a p:otherwise with a p:sink child to do nothing by default.

Hope this helps,
Romain.

Le 6 oct. 10 à 12:04, Nic Gibson a écrit :

> Hi
>
> I'm sure I'm missing something obvious here but I'm failing to see  
> it. I have a pipeline in which a step should be executed only if a  
> given element is present in the input. Otherwise, nothing need be  
> done - there is no meaningful default. So I started with:
>
>
>     <!-- generate the dedication if present -->
>     <p:choose>
>
>         <p:xpath-context>
>             <p:pipe port="result" step="text-fix"></p:pipe>
>         </p:xpath-context>
>
>         <p:when test="/db:book//db:dedication">
>
>             <cstep:create-dedication>
>                 <p:input port="source">
>                     <p:pipe port="result" step="text-fix"/>
>                 </p:input>
>                 <p:with-option name="xhtml-path" select="$xhtml- 
> path"/>
>             </cstep:create-dedication>
>
>         </p:when>
>
>     </p:choose>
>
> This fails with the error:
>
> SEVERE: It is a dynamic error if no subpipeline is selected by the  
> p:choose and no default is provided.
>
> I assume that this a meaningful way to express this sort of thing in  
> XProc but I'm vaguely stumped as to what is. Would anyone care to  
> point out the (probably obvious) approach I should be taking?
>
> cheers
>
> nic
>
> --
> Nic Gibson
> Corbas Consulting
> Digital Publishing Consultancy and Training
> http://www.corbas.co.uk, +44 (0)7718 906817 
>  
>
>
>
>
>

Received on Wednesday, 6 October 2010 12:02:15 UTC