W3C home > Mailing lists > Public > xproc-dev@w3.org > October 2011

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

From: Matthieu Ricaud-Dussarget <matthieu.ricaud@igs-cp.fr>
Date: Wed, 12 Oct 2011 12:25:07 +0200
Message-ID: <4E956B03.5000905@igs-cp.fr>
To: XProc Dev <xproc-dev@w3.org>
Hi Xproc Folks !

I'm new to Xproc and I can't figure out how to deal with primary output 
port :

- I use <p:declared-step> as root element
- I fixed main <p:output port="result"> to <p:empty/> because I want to 
store each steps output in a debuging file with <p:store> (R. Castello 
says "Since we are writing to files with p:store, set the output to 
empty" in his tuto)
- I have a <p:choose> which can lead to <p:error> if a special condition 
is not satisfied.
- It seems I have to plug my main output port to the <p:choose> so that 
the errors is thrown and stop the process

See the choose step at the bottom of this mail.

Actually Calabash raises this error :
GRAVE: It is a static error if two subpipelines in a p:choose declare 
different outputs.

Does that means what I want to do "If (test) then (error) else 
(xslt+store)" is not possible ?
Is there a way to achieve this "process" ?

Any help, tips welcome !

Matthieu

The choose step code :

<p:choose name="stop_if_viewport_inconsistence">
<p:when 
test="count(distinct-values(/igs:aggregate/doc/pages/page/@viewportX))!=1">
<p:error name="viewport_err" code="viewport_err">
<p:input port="source">
<p:inline>
<message>viewports inconsistence here !</message>
</p:inline>
</p:input>
</p:error>
</p:when>
<p:otherwise>
<p:xslt name="generateECF">
<p:input port="source">
<p:pipe step="add-viewport" port="result"></p:pipe>
</p:input>
<p:input port="stylesheet">
<p:document href="../xslt/generateECF.xsl"/>
</p:input>
<p:input port="parameters"><p:empty/></p:input>
</p:xslt>
<p:store encoding="UTF-8" omit-xml-declaration="false" indent="true">
<p:with-option name="href" 
select="concat(/ecf:content/opf:metadata/dc:identifier[@id=parent::opf:metadata/@unique-identifier],'.ecf')"></p:with-option>
</p:store>
</p:otherwise>
</p:choose>

With
<p:output port="result">
<p:empty/>
</p:output>
at the beginning.

-- 
Matthieu Ricaud
IGS-CP
Service Livre numérique
Received on Wednesday, 12 October 2011 10:25:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 12 October 2011 10:25:44 GMT