RE: Transform XML to XML
>> This is the main motivation behind the introduction of schema-awareness in XSLT 2.0. Awesome! So when do you think most tools will support 2.0? 2007? 2008? -Mike -----Original Message----- From: Michael Kay [mailto:mike@xxxxxxxxxxxx] Sent: Friday, August 26, 2005 3:52 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: Transform XML to XML > 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/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format