- From: David Cramer <david@thingbag.net>
- Date: Fri, 23 Dec 2011 21:38:23 -0600
- To: xproc-dev@w3.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi there, The example below works for me, but I would like to stop processing and print the errors to stdout/stderr when the document is invalid. I can get it to stop processing by adding a p:error in the p:catch: http://pastebin.com/K7vNVBqs But I haven't figured out how to make it display the error messages in any form. Any pointers? Thanks, David On 11/22/2011 03:13 PM, Norman Walsh wrote: > "Imsieke, Gerrit, le-tex" <gerrit.imsieke@le-tex.de> writes: >> I had or rather I still have similar issues. I was bothered by >> the fact that Schematron validation provides a "report" port >> which the schema-based validations lack. >> >> p:validate-with-relax-ng for example has a single output port >> which will only reproduce the document if it is valid (or if >> @assert-valid="false"). >> >> In order to catch errors, I wrapped p:validate-with-relax-ng into >> a try/catch and forwarded the "error" port of the catch branch to >> a "report" output port that I declared for both branches. > > Right. And you can wrap that up in a custom step that you reuse > and get just want you want. Here's an example that returns the > validated document and an empty result port or the unvalidated > document and an error report: > > <p:declare-step type="ex:validate-with-relax-ng" name="main"> > <p:input port="source"/> <p:input port="schema" sequence="true"/> > <p:output port="result" primary="true"> <p:pipe > step="tryvalidation" port="result"/> </p:output> <p:output > port="report" sequence="true"> <p:pipe step="tryvalidation" > port="report"/> </p:output> > > <p:try name="tryvalidation"> <p:group> <p:output port="result"> > <p:pipe step="xmlvalidate" port="result"/> </p:output> <p:output > port="report" sequence="true"> <p:empty/> </p:output> > > <p:validate-with-relax-ng name="xmlvalidate"> <p:input > port="source"> <p:pipe step="main" port="source"/> </p:input> > <p:input port="schema"> <p:pipe step="main" port="schema"/> > </p:input> </p:validate-with-relax-ng> </p:group> <p:catch > name="catch"> <p:output port="result"> <p:pipe step="main" > port="source"/> </p:output> <p:output port="report"> <p:pipe > step="id" port="result"/> </p:output> <p:identity name="id"> > <p:input port="source"> <p:pipe step="catch" port="error"/> > </p:input> </p:identity> </p:catch> </p:try> </p:declare-step> > >> <aside> I just found out that p:validate-with-relax-ng will only >> give me the first error. But it’s wrapped in c:errors and c:error >> elements, like this: > > That's a bug. Fixed in github. You'll now get multiple c:error > elements in a c:errors wrapper. I also fixed it in XSD and > improved the report for DTD validation from p:load. > >> A uniform report port for all types of validation is clearly >> desirable. > > Indeed. > > Be seeing you, norm > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJO9UkvAAoJEMHeSXG7afUhqn8H/3yC2JYtmBOwBaUmqeRA+CRU vGjag2x1voGMeLGmU6CxBrsUFgdKd7msTaH1GqleIGzWdIRso6MKNLISCFNpp5d9 2L9CfKDL2zoxs24QXjxRAd0qLxBzdzTn0kS5JalROWExgUzSUJkKg02jecObYIF2 /G/lH8G3SqdapVYhdVZwgJcf9KtZgFXElst8ZzTxnqopfcjnRbXp3CDTEWeVers+ Sw29keXjLAdsWbjs5OeT6ZbZRoucpXrO/Ad80Yy08A4J/DPlTaM7aPvOqCSpE4ir rVSdzmqDXbB7IaIA+UEPxFtKZ9f2aq7MEIqPAGYXDfu0TqwKMESUnPyIcJWDBKA= =YUfj -----END PGP SIGNATURE-----
Received on Saturday, 24 December 2011 03:38:58 UTC