Re: [xsl] XPath "//", speed, and Saxon

Subject: Re: [xsl] XPath "//", speed, and Saxon
From: Tony Graham <Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 03 Nov 2008 14:37:13 +0000
On Mon, Nov 03 2008 12:55:12 +0000, mike@xxxxxxxxxxxx wrote:
>> A lot of time, effort and money goes into testing, but for 
>> XSLT, I think that effort would be better spent on fully 
>> schema aware transforms than unit testing.  What do you think?
> I think a lot of stylesheets go into production after testing with a very
> small sample of input documents. It's often too expensive to do anything

I concur.

> else. In this situation, developing with schema awareness can greatly
> increase your confidence that the stylesheet will also be able to handle
> input documents that vary significantly from your initial sample.

Up to a point.  If you neglect to handle an optional input element or
attribute or you map the wrong input to a valid output element or
attribute, then having a schema isn't going to help much.

An up-front good mapping from input to output still trumps the
combination of a schema-aware processor and designing at the keyboard.
(And, yes, a schema-aware processor and some planning could trump both.)

A schema is a useful guide for what to expect, and having input that is
schema-valid means that you don't have to prepare (as much) to handle
unexpected input.

In some ways, the old-fashioned 'match="*"' template rule that emits a
message or outputs the element name in red for any element that isn't
handled elsewhere is still useful even when you have schema awareness.

Schema awareness awareness is useful too: I have met the approach that
the schema is really only useful for working out what to put in "match"
attributes.  (That person was using XSLTC translets, so couldn't have
done much with the schema even if he'd wanted to.)

Something like XSLV for verifying that valid input produces valid output
or a coverage tool (non-existent, AFAIK) that tells you whether your
stylesheet can handle everything in a schema would also still be useful.


Tony Graham                         Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                     
xslide Emacs mode        
Unicode: A Primer                               urn:isbn:0-7645-4625-2

Current Thread