[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Transform XML to XML

Subject: RE: Transform XML to XML
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 26 Aug 2005 08:51:55 +0100
transform xml to xml tutorial
> One thing I do really dislike about XSLT, at least from what I
> understand, is there doesn't seem to be a way to write robust code in
> XSLT; if my input XML is off by a bit (i.e. well-formed but not
> validated by a schema), or if I make a boneheaded change to 
> the XSL, the
> transform may not output what I expect but there's little way 
> for me to
> catch the error without painstaking proofreading after each transform
> (scenario: after somethings been printed for a while; opps, looks our
> XSL forgot to include that chapter!)

This is the main motivation behind the introduction of schema-awareness in
XSLT 2.0.

Firstly, you can validate the output against a schema. Sometimes you will
get compile-time error messages telling you that the stylesheet cannot
possibly produce valid output; more often you will get run-time error
messages telling you that line 1234 of the stylesheet is trying to output
something that's invalid (or failing to output something that's required).
My experience is that this greatly speeds up the debugging cycle.

Secondly, you can validate the input against a schema, and define your
template rules in terms of schema types. For example <xsl:template
match="schema-element(invoice)"/>. This enables the XSLT processor to do a
lot of compile-time checking of your stylesheet code, for example it can
spot path expressions that could never select anything.

Give it a try (follow the link below).

Michael Kay
http://www.saxonica.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.