[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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

Subject: Re: [xsl] Reasons for using XSLT to validate XML instances?
From: "Wolfgang Laun wolfgang.laun@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 Jun 2015 18:35:45 -0000

The term "validation" applied to XML (or any other data format) is not
absolute. XML according to W3C's recommendation "Extensible Markup Language
(XML)" is "validated" by any good XML parser. On a higher level, elements,
attributes, their values and their compositions can be specified, and then
a "validation" can be done against this schema. Finally, on a very much
higher level, logical constraints on the contents of elements and
attributes, across the entire document, can be "validated" against a
specification going beyond formal rules.

In a way, these levels correspond to lexical analysis, syntactic analysis
and semantic analysis as known from the classic compiler construction.


On 19 June 2015 at 20:14, PQQP5QP;P0P2 P!P5P4P>P2 schematronic@xxxxxxxxx
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> + you can use same xslt to check input data for client-side and
> server-side, maybe in some cases it even more simple - convert xsd (by
> xslt - not "hands") to schematron rules (almost same as xslt) for
> interoperability
> 2015-06-19 22:13 GMT+05:00 Rob Koberg rob.koberg@xxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>:
> > Using XML Schema (which you can use inside a transformation with Saxon
> > 2+) will tell you if your document is truly valid according to the XML
> > Schema :)
> >
> > Using XSL to validate means you will need to determine the rules which
> > may or may not indicate an instance document is valid according the
> > XML Schema.
> >
> > On Fri, Jun 19, 2015 at 9:57 AM, Costello, Roger L. costello@xxxxxxxxx
> > <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> >> Thank you Graydon and Wolfgang. Good inputs.
> >>
> >> For validation problems, is XPath 2.0 as powerful as XSLT 2.0?
> >>
> >> My hunch is no, but I can't think of an example of a validation problem
> that can be done in XSLT 2.0 and cannot be done in XPath 2.0. Can you think
> of an example? If one could come up with an example, it would show that
> some validation problems cannot be solved by Schematron and must be solved
> by XSLT.
> >>
> >> /Roger

Current Thread