- From: Norman Walsh <ndw@nwalsh.com>
- Date: Wed, 12 Oct 2011 06:59:18 -0400
- To: XProc Dev <xproc-dev@w3.org>
- Message-ID: <m2botmh3w9.fsf@nwalsh.com>
Matthieu Ricaud-Dussarget <matthieu.ricaud@igs-cp.fr> writes: > Actually Calabash raises this error : > GRAVE: It is a static error if two subpipelines in a p:choose declare > different outputs. This is one of the inconvenient corners in XProc. You have to arrange for all the branches of a p:choose (and a p:try/p:catch) to produce the same outputs. You've also hit another corner case. The WG decided that the most common case for a p:choose was one where each branch produced a single output. In that case, putting in a p:error branch was inconvenient because it didn't produce any output, so you had to put some sort of a dummy step after it in order to make sure that that branch conformed to the rule. But because that step wasn't going to have any data-flow connection to the p:error, you also had to wire it up explicitly. All of this was terribly inconvenient. So the WG decided to give p:error a primary output port. Nothing will ever appear on it, but it satisfies the rule about consistent outputs. Except, in your case, the other branch *doesn't* produce any output. Sigh. Maybe we should have increased the burden on implementors instead and stated that any branch that must end in a p:error doesn't count. But we didn't. Here's the fix: > <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:sink/> > </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> That p:sink consumes the output of p:error and as a result, neither branch has a primary output port and so the rules for p:choose are satisfied. BTW, you don't need to say: <p:output port="result"> <p:empty/> </p:output> If you're pipeline doesn't have any output, simply don't declare any output ports. Be seeing you, norm -- Norman Walsh Lead Engineer MarkLogic Corporation Phone: +1 413 624 6676 www.marklogic.com
Received on Wednesday, 12 October 2011 10:59:52 UTC