Jeff Barr's Blog

Things I Like..

AXDC – Kurt Cagle, XSLT2 and Saxon.Net

Kurt will describe a .Net implementation of XSLT2. He runs Metaphorical Web Publishing, has authored 16 books (including one on SVG), and has a blog.

Despite the fact that they have 56,000 employees, Microsoft has yet to implement this new standard.

Saxon.Net is the first implementation of XSLT2 for .Net.

XSLT is crucial in a number of roles: document conversion, business logic processing, macro code generation, message routing, data mapping and transfer, and so forth.

As of 2004, XSLT is now supported on most platforms, and is on its way to becoming pervasive. Every procedural language has some XSLT support. There are also firmware implementations. A very common way to do processing, on any system, anywhere.

How many of you have used XSLT? 95% of those in the room raised their hands.

Problems with XSLT: Verbose, recursion needed far too much, tree fragments, lack of extensibility, string handling is poor, grouping (breaking a document into sections) is awkward or impossible, and there are sorting limitations (strings, numbers, and ISO dates only).

Processors include MSXML, System.Xml.Xsl, Xalan (Java), Saxon (Java), LibXSLT/XSLTProc (C++, Linux), and Sablotron (PHP/Windows & Linux).

Saxon 6.5 is earliest and most compliant XSLT1 processor, written by Michael Kay. Includes some namespace extensions. Saxon 8.* is the XSLT2 implementation.

EXSLT is an extension to XSLT; open source extension movement, extended math support, invocable XSLT functions, regular expressions, randomization, multiple output documents. It is (informally) XSLT 1.1.

XSLT 1.1 + EXSLT => XSLT 2.0. XSLT 1.1 problems too great to fix and EXSLT is a stopgap.

So, XSLT2 is where its at. Under development for the last 2 years, at least 1 more year to go due to some changes to XPath and XQuery. Definitely a moving target.

Trees vs. forests. Forest is a living organism very unlike its trees.

XPath 1.0 data model has lots of flaws — node list confusion, something about document(), no generalized enumerators, no set operations. Therefore XSLT2 is dependent on XPath2, which implements sequences — linear collection of objects (not nodes, and not necessarily homogeneous).

XPath2 and XSLT2 both support regular expressions. Token() and join() functions are new. Regex test(), matches(), and replace() functions.

Input serialization — the new doc() function can pull text in from the outside world and create a tree from us.

Conditional expresions.

Saxon.net is a .Net port of the Java code,translated using theIKVM tool.

Early 2006 XPath2 and XSLT2 complete; Saxon.Net ready to run.

SVG Programming