Re: New to Xproc Question : conditionnal "output port" definition?

Matthieu Ricaud-Dussarget <matthieu.ricaud@igs-cp.fr> writes:
> Once again, thanks a lot for your help.
>
>> <p:xslt ... name="xslt"/>
>> <p:store .../>
>> ...
>> <p:error ...>
>> 	<p:input port="source">
>> 		<p:pipe step="xslt" port="result"/>
>> 	</p:input>
>> </p:error>
> I thought the input port of <p:error> shall contains the error message 
> itself (within <p:inline> for example). I guess I have to get 
> information on how to deal with error code and message to display.
> Anyway the problem is just above :
> <p:when 
> test="count(distinct-values(/igs:aggregate/doc/pages/page/@viewportX))!=1">
> <p:error ...>
> </p:when>
> My guess is that the xproc processor is not able to perform the xpath 
> test above because it can't define a context node at this point of the 
> pipeline... because just above is a <p:store> which doesn't through any 
> output!

I've lost track of the whole pipeline, but you can provide the context
for a p:when with p:xpath-context:

  <p:when test="...">
    <p:xpath-context>
      <p:pipe .../>
  ...

>> But since this is a common case, it is worthwhile to declare a helper step to do that.
> 100% agree !
>> I wrote the following, which combines a p:store with such input
>> rerouting, together with a p:choose so the p:store is only done if a
>> debug parameter was passed through..
> I actually don't know how to use such a self define step.
> My xpl file starts with <p:declared-step> element : It seems I can't add 
> a <p:declared-step> within my root element <p:declared-step>.
> I thought I should put it in another xpl document and then import it 
> from my current xpl with <p:import> but... It's seems <p:import> is not 
> allowed as child of <p:declared-step>.

You can put a declare-step inside a declare-step. If you're having trouble,
it'll be easier to figure out if you post the pipeline that's causing problems.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

Received on Wednesday, 12 October 2011 15:31:43 UTC