- From: Paul Hermans <paul@proxml.be>
- Date: Tue, 17 Mar 2009 16:03:29 +0100
- To: xproc-dev@w3.org
- Message-Id: <6C8ACE25-27E1-40EE-B706-D19CEA55C80B@proxml.be>
Using Calabash. I have following try/catch which works both for valid and non-valid docs. <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step "> <p:try> <p:group> <p:validate-with-xml-schema assert-valid="true" mode="strict"> <p:input port="source"> <p:document href="file:///Users/paul/Desktop/R&D/ xmlschema/msData/simpleType/stE056.xml" /> </p:input> <p:input port="schema"> <p:document href="file:///Users/paul/Desktop/R&D/ xmlschema/msData/simpleType/stE055.xsd" /> </p:input> </p:validate-with-xml-schema> <p:identity> <p:input port="source"> <p:inline><c:result>valid</c:result></p:inline> </p:input> </p:identity> </p:group> <p:catch> <p:identity> <p:input port="source"> <p:inline><c:result>invalid</c:result></p:inline> </p:input> </p:identity> </p:catch> </p:try> <p:store href="/Users/paul/Desktop/R&D/xmlschema/msData/simpleType/ stE055.res" name="store"/> </p:declare-step> Now I'm doing the same within a loop <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:wts="http://www.w3.org/XML/2004/xml-schema-test-suite/" xmlns:c="http://www.w3.org/ns/xproc-step" xmlns:xlink="http://www.w3.org/1999/xlink " xpath-version="2.0"> <p:output port="result" sequence="true"> <p:pipe port="result" step="loop"/> </p:output> <p:load href="/Users/paul/Desktop/R&D/xmlschema/msMeta/ SimpleType_w3c.xml"/> <p:for-each name="loop"> <p:iteration-source select="/wts:testSet/ wts:testGroup[wts:instanceTest/wts:instanceDocument]"/> <p:output port="result" sequence="true"> <p:pipe port="result" step="write2file"/> </p:output> <p:variable name="xsd" select="substring-after(/wts:testGroup/wts:schemaTest/ wts:schemaDocument/@xlink:href,'/')"/> <p:variable name="xml" select="substring-after(/wts:testGroup/wts:instanceTest/ wts:instanceDocument/@xlink:href,'/')"/> <p:load name="schema"> <p:with-option select="$xsd" name="href" xml:base="/Users/paul/Desktop/R&D/xmlschema/"/> </p:load> <p:load name="instance"> <p:with-option select="$xml" name="href" xml:base="/Users/paul/Desktop/R&D/xmlschema/"/> </p:load> <p:try name="try"> <p:group> <p:validate-with-xml-schema assert-valid="true" mode="strict"> <p:input port="source"> <p:pipe port="result" step="instance"/> </p:input> <p:input port="schema"> <p:pipe port="result" step="schema"/> </p:input> </p:validate-with-xml-schema> <p:identity> <p:input port="source"> <p:inline> <c:result>valid</c:result> </p:inline> </p:input> </p:identity> </p:group> <p:catch name="catch"> <p:identity> <p:input port="source"> <p:inline> <c:result>invalid</c:result> </p:inline> </p:input> </p:identity> </p:catch> </p:try> <p:store name="write2file"> <p:with-option name="href" select="concat('/Users/paul/ Desktop/R&D/xmlschema/',$xml,'.err')"/> </p:store> </p:for-each> </p:declare-step> As long as all files are valid, I do get the required output. Once I encounter a non-valid file, I get following error: Pipeline failed: err:XD0007: null If sequence is not specified on p:output, or has the value false, then it is a dynamic error if the step does not produce exactly one document on the declared port. Something related to the error output on the catch? Kind Regards, Paul Hermans -------------------------
Received on Tuesday, 17 March 2009 15:04:13 UTC