Actually, whether you use a schema-aware XSLT 2.0 processor or a plain
vanilla XSLT 1.0 processor, validation of the source document is something
you invoke as a separate operation before the transformation starts. There
may be an API that makes it seamless, or you might do the two steps using
completely different products invoked independently, but logically they are
separate operations.
The difference if you use a schema-aware XSLT processor is that the XSLT
processing takes account of information gained during validation, for
example it knows which attributes are numbers or dates, and it knows where
in the document a <title> element might be found.
You can invoke validation from within XSLT if you have a schema-aware
processor: you can do <xsl:copy-of select="/" validation="strict"/>.
However, the normal assumption is that it's better to do the validation
on-the-fly while the source document is being parsed rather than creating a
validated copy of the original unvalidated input. In Saxon there are various
API and command-line switches to say "parse this document (or all documents)
with schema validation switched on".
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Mark Anderson
[mailto:mark(_dot_)anderson(_at_)technique-group(_dot_)com]
Sent: 19 July 2007 10:48
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Validating XML against a Schema using XSLT
Hi All
I'm working on a new XSL project where I will receive and XML
from an external system, and transform it into a T-SQL script.
I have created a schema for the supplied XML and I want to
find a way to validate the XML against the schema before I
even start to transform it to T-SQL (this will dramatically
simplify my stored procedure, as I can skip most of the error
checking for required fields and correct data
types)
Is there a way to do this with XSL? Right now I'm using 1.0
and MSXML, but if it required a SA XSLT processor, we could
spring for that.
Regards
M a r k
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--