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

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: Thu, 21 Feb 2013 23:53:06 +0100
Message-ID: <5126A552.3030708@le-tex.de>
To: xproc-dev@w3.org
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
Received on Thursday, 21 February 2013 22:53:40 GMT

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