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

Re: Why should I put code in XSLT to check the input d

Subject: Re: Why should I put code in XSLT to check the input data or the output data?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 20 May 2010 23:06:00 +0100
Re:  Why should I put code in XSLT to check the input d
On 20/05/2010 21:59, Costello, Roger L. wrote:
Hi Folks,

My thinking is that the input data should be checked using XML Schema and Schematron. Ditto for the data that is output by XSLT.

I see no reason to include in an XSLT program any code to check data. It just makes the program bigger, harder to understand, harder to maintain, and harder to debug.

Do you agree?

No, not at all!



/Roger

If by XML Schema you mean XSD, then most of the time I'd rather not use it at all, ever. But even if you include Relax NG or DTD in "XML Schema" it's often preferable to not validate at run time.


A grammar validator (not schematron) is usually just a binary pass/fail.
That's fine if you want to reject invalid documents, but if you test for things in XSLT you can do different code paths and often make correct output out of less than perfect input.


Checking the output makes sense of course, just to check the output, although it depends on the transform, some transforms are guaranteed to produce valid documents, just because the output is sufficiently regular that unless it stops due to some fatal error the result will be valid.

David

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.