W3C home > Mailing lists > Public > xproc-dev@w3.org > February 2013

Re: conditionally do something depending on whether there’s a document on the input port

From: Imsieke, Gerrit, le-tex <gerrit.imsieke@le-tex.de>
Date: Fri, 22 Feb 2013 00:32:44 +0100
Message-ID: <5126AE9C.8030604@le-tex.de>
To: xproc-dev@w3.org
Ok, I used p:for-each then:

     <p:for-each name="conditionally-patch-html">
       <p:iteration-source>
         <p:pipe port="html-in" step="validate-with-schematron2"/>
       </p:iteration-source>

Gerrit

On 21.02.2013 23:53, Imsieke, Gerrit, le-tex wrote:
> I’ve developed a step that validates with Schematron and inserts the
> validation messages into an HTML rendering of the validated document
> (the document and the HTML rendering are passed to the step on
> individual input ports). The step also takes as input the accrued
> reports of other upstream Schematron validations and renders them, too.
>
> Because this operation is costly for large documents and when there are
> many messages to patch into the document, I’d like to avoid this
> patching procedure until the very last Schematron validation.
>
> So I though that if I send a <p:empty/> to the HTML input port for all
> but the last invocations of my custom Schematron/patch step, I may be
> able to conditionally avoid the costly operation:
>
>      <p:choose name="conditionally-patch-html">
>        <p:xpath-context>
>          <p:pipe port="html-in" step="validate-with-schematron2"/>
>        </p:xpath-context>
>        <p:when test="not(node())">
>
> ⇒
>
> SEVERE:
> converter/xpl/validate-with-schematron.xpl:157:34:err:XD0026:Expression
> refers to context when none is available: boolean(not(node()))
> Feb 21, 2013 11:28:18 PM com.xmlcalabash.drivers.Main error
> SEVERE: It is a dynamic error if the select expression makes reference
> to the context node, size, or position when the context item is undefined.
>
> How can I test whether there’s no document on an input port?
>
> Gerrit
>

-- 
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsieke@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vöckler
Received on Thursday, 21 February 2013 23:33:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 21 February 2013 23:33:22 GMT