Tuesday, June 13, 2017

XSLT 3.0 reaches W3C Recommendation status

Not long ago, XSLT 3.0 has reached the W3C Recommendation status. Below is the link to the XSLT 3.0 spec:

https://www.w3.org/TR/2017/REC-xslt-30-20170608/

XSLT 3.0 is a very advanced and useful language, as compared to XSLT 2.0. One of the main features (among others) introduced in XSLT 3.0, is that the XSLT transformation can be done in streaming mode.

Thursday, June 1, 2017

XPath 2.0 atomization in XML Schema 1.1 validation

XPath 2.0 atomization as a concept, as applicable to XML Schema 1.1 validation is worth looking at. I would like to ponder on this in this post, with a brief example.

Consider the following brief XML Schema 1.1 validation example.

XSD 1.1 document:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 
   <xs:element name="X">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="a" type="xs:integer"/>
            <xs:element name="b" type="xs:integer"/>
         </xs:sequence>
         <xs:assert test="a gt b"/>
      </xs:complexType>
   </xs:element>
 
</xs:schema>

XML document that is fed to the XML Schema 1.1 validator, when validating with the above XSD document:

<?xml version="1.0"?>
<X>
  <a>4</a>
  <b>7</b>
</X>

This XML document fails validation, because "a" is less than "b". Now what is XPath 2.0 atomization, as for in this example that I want to talk about?

Since the XML document has been validated with the mentioned XSD, while building the XPath tree to apply <assert>, the nodes of the tree are annotated (or decorated) with the XSD types as mentioned in the XSD document. Therefore, the <assert> XPath 2.0 expression "a gt b", comes with runtime availability of the corresponding XSD types on <assert> tree nodes for "a" and "b". In XPath 2.0 terms, the <assert> tree nodes for "a" and "b" have been atomized. The Schema aware XPath 2.0 in action, is same in <assert> as in the generic Schema aware XPath 2.0 processor.

The XSD 1.1 processor that I've used for this example is located at https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev/.