xsl-list
[Top] [All Lists]

Re: [xsl] Reasons for using XSLT to validate XML instances?

2015-06-19 11:05:34
On Fri, Jun 19, 2015 at 03:49:50PM -0000, Costello, Roger L. 
costello(_at_)mitre(_dot_)org scripsit:
Hi Folks,

XML Schema can validate XML instances.

Schematron can validate XML instances.

Is there ever a situation where it would be preferable to use XSLT to 
validate XML instances? 

Schematron _is_ XSLT, in the sense that what Schematron generates and
runs is an XSLT stylesheet.

If you have to validate the whole structure, you want a schema; XSD,
RelaxNG, or other.

If you're trying to check for specific things like date ranges or how
many paragraphs are in a section, Schematron works much better.
Hand-coded XSLT could also work.

(Though I personally prefer XQuery for that purpose.)

It's important to remember that you don't need to do, and maybe
shouldn't do, all your validation in one pass; a "well-formed?", "valid
by the DTD?", "valid by our style rules?" succession of independent
checks can work much better when you're, for instance, checking
externally produced content you're importing.

-- Graydon
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>