Re: [xsl] XSLT 2.0: Schema-aware processor: What are the compelling advantages over a non-SA processor?

Subject: Re: [xsl] XSLT 2.0: Schema-aware processor: What are the compelling advantages over a non-SA processor?
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 18 Jul 2007 09:30:27 +0200
Justin Johansson wrote:
Hello again,

Per my previous post, I've made a significant personal investment in
learning XSLT 2.0.  I use Michael Kay's Saxon 8b (non-SA) processor and
think it absolutely rocks.

To continue on my journey of XSLT enlightenment, I'd like to know what the
compelling reasons are to use an XSLT 2.0 schema-aware processor. Is Dr.
Kay's/Saxonica'a the only one out there?

Do you have a background in general programming? Remember the time that GOTO was declared dead and procedural programming came along? Remember when around 1993 (smalltalk addicts will give an earlier date I am sure) the discussion about OO really hit the market? Remember the quite current discussions about the mess that is made by people (often self-taught non-programmers trying to program) using untyped languages such as Perl, PHP and VB?


It is like many of those discussions: a more structured language will help a poor programmer, whereas a less structured language will work against him/her. A good programmer can still make a rather good program with a poor or weakly typed language, but this same good programmer will know how to benefit from the added features that a strongly typed language brings.

In terms of XSLT: when you use the Schema aware version, it is closely (?) equivalent to a typed language. A typed language will give you compile time errors when you use incompatible variables or data without the proper handling. The same is true for XSLT. In addition, you can validate both input and output (and any other complex type you use during processing) right from your xslt processor.

However, note that with non schema aware processors, you can still use the the basic schema types, as in:

<xsl:template match="field" as="xs:string*">
   <xsl:sequence select="tokenize(., ',')" />
</xsl:template>

Probably I'll purchase a copy anyway, even if for no other reason other
than to show my appreciation for his excellent work and kind open sourcing
of Saxon non-SA.  Unfortunately the last few XSLT contracts I've had have
been on MSXML/XSLT 1.0 shops so I haven't had the benefit of employer
support for XSLT 2.0 let alone a schema-aware processor.

Most of the time, a project the uses XSLT 1.0 can easily be upgraded to XSLT 2.0. You can tell your employers that all it takes is a .NET library in their projects. Perhaps they already use .NET in which case it is even easier. Sticking to XSLT 1.0 in any given project, unless locked in by a vendor, is ludicrous, I think.



Cheers, -- Abel Braaksma

Current Thread