[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
XSD 1.1 schema for polyglot XHTML5
- From: Jesper Tverskov <jesper.tverskov@gmail.com>
- To: xml-dev@lists.xml.org
- Date: Fri, 27 May 2011 13:51:54 +0200
Inspired by David Carlisle's polyglot Schematron schema,
http://code.google.com/p/web-xslt/source/browse/trunk/polyglototron/polyglototron.sch
I ventured into the slipstream to test if it is possible to make
something similar with assertions in XML Schema 1.1, XSD 1.1:
http://www.xmlplease.com/polyglot-xhtml5.xsd
Works like a charm with SAXON 9.3 EE at the command line. It also
works well inside Oxygen XML Editor but you have to fine tune settings
to get it working:
In Options/Preferences/XML Parser/Saxon EE Validation
Check 1.1 and check "Use Saxon EE as default XML Schema validation engine".
We are all in love with RELAX NG and Schematron, but I have not met
anyone yet outside the circles of this mailing list, having heard
about those schema languages.
Nice that it is possible to make HTML5/XHTML5 validation also with XSD
1.1. and that we only need one schema language to do the whole job.
Except that I don't know of a full HTML5/XHTML5 xsd schema yet?
Also nice, which I have not tried before, that we can make an xsd 1.1
schema with no grammar validation only containing assertions!
The only problem with the above solution is, that because we have no
grammar, all the assertions are declared inside the html element's
complexType. It means that the line number and position reported, is
the line number and position right after the html element's end tag.
If we added the full grammar, the error messages, with the help of
saxon:message, would be excellent in most use cases. By the way: I
find it incredible that the "message" attribute is not a standard
attribute. Assertions in XSD 1.1 are useless without it.
Saxon, as MK has just told me, treats the empty() function nicely when
used in certain types of assertions: the error message will include
one or more XPath expressions pointing to the error(s), like:
html/body/p[3]. Unfortunately I have only been able to use empty() a
couple of times because most of the assertions need the pattern "every
$a in .... satisfies .... $a ..." to bring functions like matches()
etc into play.
Cheers
Jesper Tverskov
http://www.xmlplease.com
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]