Crazy idea

Rick Jelliffe ricko at allette.com.au
Mon Sep 6 19:26:10 BST 1999


 From: Oren Ben-Kiki <oren at capella.co.il>

 >A DTD/XSchema, as defined today, performs two tasks. One is to
validate a
>document. The output of this is a single Boolean value. The other is to
>"complete" the document - that is, add defaults.
>
>The latter part seems like a transformation task to me, which raises
the
>question: why not specify this as an XSLT stylesheet? Once you consider
>this, it becomes obvious that the first part can also be specified as a
>stylesheet, given that one introduces some way for a stylesheet to
indicate
>an error in the input (say, <xsl:error>). Actually, that's a good idea
by
>itself. I already simulate it in my stylesheets by emitting an
obtrusive
>error boilerplate, but that's a kludge.

>How about it?

I have a note on "Using XSL as a Validation Language" at
http://www.ascc.net/xml/en/utf-8/XSLvalidation.html also published in
July Interchange magazine (ISUG).  The implications of XPath are
sketched out in the note "Axis Models and Path Models" at
http://www.ascc.net/xml/en/utf-8/validaxis.html

Francis Norton has a subsequent article  "Generating XSL for Schema
Validation" at http://www.redrice.com/ci/generatingXslValidators.html
which gives an XSL stylesheet for generating an XSL validator from a DCD
schema. (Francis has worked further on this line, and may update that
article and the software sometime, I believe.)

I think it is worthwhile to raise the possibility that validation is not
really a binary function, though it is convenient to speak of it as such
for rhetorical purposes.  In fact, a validator that merely says "valid"
or "invalid" is almost useless (not quite: it is still useful for giving
structural preconditons that a progammer can use to reduce the number of
cases their program has to deal with) and certainly unacceptable for
users: it is the diagnostic information which is the useful thing.
Rather than considering the diagnostics as nice side-effects that a
validator may do, by using XSL we can make the diagnostic information
the centre of attention for validation.

This has a big impact on schemas: rather than the schema being a passive
description, it should become a far more user-friendly and active thing:
for example, a schema language might require  that repeated groups of
elements in content models should be given a name, which diagnostic
messages can give to the user to help them.  Or the schema could include
declarations for error-recover from validity errors: if a certain
element is found out of context, then repair it or sanitize it.  I don't
see why a schema should not include such things.

For anyone interested, there are also other articles on various
alternatives to DTDs and content models at
http://www.ascc.net/xml/en/utf-8/schemas.html  If anyone is going to the
APWeb99 conference in Hong Kong later this month, I am giving a paper on
this subject. Anyone in Taiwan can contact Academia Sinica Computing
Centre; we are giving XML workshops that include the topic "Using XSL
for Validation".

Rick Jelliffe


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list