Re: [xsl] How to read Schema XSD in stylesheet XSL!

Subject: Re: [xsl] How to read Schema XSD in stylesheet XSL!
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 29 Nov 2007 23:59:54 +0100
Eliot Kimber wrote:
Abel Braaksma wrote:

In all honesty, all you need is an XML processor that supports Schema processing. You do not need any XSLT. But if you are determined to use XSLT, just use XSLT 2.0 with validation (available with Saxon-SA and AltovaXML, the latter free). If the content is valid, output "yes", if not,. output "no". For all that I know, you can write any stylesheet (as long as validation is on) and let it output something. If the output is nothing or an error or a different exit code, you let your calling process (i.e., a batch file or a workflow system) output "no". Or, like Wendell suggested, use the extension functions of Saxon.

Note that you don't need SaxonSA to do schema-validated XSLT processing of documents, you just need to use a parser that is both schema-aware (e.g., Xerces) and is configured to do schema validation. This requires a small bit of Java code or doing the necessary Java system property configuration to set it up.

Precisely, which is why I mentioned "you do not need any XSLT". A simple batch file (or shell script) which will setup the necessary properties will suffice, you can even have your batch file output "yes" or "no".


What you need SaxonSA for is to do schema *aware* XSLT processing such that you can refer to data types and complex types defined in your schema in your XSLT templates.

Exactly. And once you start doing it you wonder why you ever did it without. To me it gave about the same feeling as when I went from weekly typed (i.e. QBasic) to strongly typed (i.e. VB.NET).


Cheers,
-- Abel Braaksma

Current Thread