xsl-list
[Top] [All Lists]

RE: Apply-templates - how to omit top level element tags?

2005-09-09 15:36:15
XSL is fragile because you can break things by messing
around?  That's pretty much true of any complex system.

Yes: though more true of some systems than of others.

XSLT 1.0 is designed with a rather different notion of robustness than many
other languages: it's designed on the principle that if you hit something
unexpected in the input, you should struggle on to produce some kind of
output rather than catching fire and printing a stacktrace on the poor
user's screen. There are times when this is quite a good idea. But it does
have the consequence that writing incorrect code often causes the stylesheet
to produce garbage output. Other languages have a different notion of
robustness: incorrect code should wherever possible produce an error message
to tell you what you've done wrong.

XSLT 2.0, especially if you opt for schema-awareness, has swung a long way
towards this more conventional definition of robustness. Write a schema
describing the input document, and a schema describing the output document,
and write your stylesheet code to be schema-aware, and you will find that
many of your coding errors are detected at compile time, or failing that at
run-time. If this is a style you are more comfortable with, give
schema-aware XSLT a try, and tell us how you get on.

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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>