Subject: Re: [xsl] [XSLT 2.0] Checking that an element's value has the desired datatype? From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 17 Oct 2006 12:22:01 +0100 |
> As best I can tell, the functionality of Schematron + xPath 2.0 is a > superset of XML Schemas (and RelaxNG). There is one major piece of XSD functionality that is not available in schematron or Relax NG. XSD schema does not just validate the input, it _annotates_ the input returning a PSVI. The fact that it does this rather than returning the original XML document is highly controversial still and one of the main design considerations for relax NG was that it did not do that. However it's undeniable that XSD has this functionality and that a large part of the design of XPath2 is designed to use that functionality. You can check in the stylesheet (or equivalently with schematron) that flt:Aircraft/flt:Altitude is an integer (or decimal or whatever type you want) but it is then your responsibility to choose an appropriate code path. If instead you schema-validate and then use a schema-aware stylesheet then not only does the schema check that the input is an integer, the input tree is modified so that this type information is permanently attatched to the data, which means that you don't need to use number() in places like: number(flt:Aircraft/flt:Altitude) gt number($j/flt:Height + $j/flt:Elevation + 500) The system would know that flt:Aircraft/flt:Altitude was a number without being told every time, and if you use the data in a place where an integer is not allowed, it will generate an error rather than assuming you want to use the element content as a string. David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] [XSLT 2.0] Checking that , Costello, Roger L. | Thread | Re: [xsl] [XSLT 2.0] Checking that , Andrew Welch |
Re: [xsl] [XSLT 2.0] Checking that , Abel Braaksma | Date | Re: [xsl] [XSLT 2.0] Checking that , Andrew Welch |
Month |