RE: [xsl] "Debugging" XSLT? Experiences and Methods...

Subject: RE: [xsl] "Debugging" XSLT? Experiences and Methods...
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 20 Jul 2005 18:31:53 +0100
A lot of the work in XSLT 2.0 that tries to make the language more strongly
typed is addressing this issue. Defining a schema for your source document
and result document, importing these schemas into the stylesheet, and using
the new facilities to declare data types for the variables, templates, and
functions in your code, will go a long way towards early detection of
errors. It can't eliminate the need to generate test cases that provide
thorough code coverage, but in practice, you'll get more errors out with
fewer test cases. Some of these will be detected at compile time, some at
run-time.

Give this a try with Saxon-SA and let us know your experiences.

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

> -----Original Message-----
> From: Karl Koch [mailto:TheRanger@xxxxxxx] 
> Sent: 20 July 2005 17:35
> To: Mulberry list
> Subject: [xsl] "Debugging" XSLT? Experiences and Methods...
> 
> Hello all,
> 
> by now I have done some XSLT scripting mostly with our help and with
> background from many many trials and good O'Reilly books :-). 
> I have also
> background in a range of programming languages. Coming from 
> thie background
> I find it quite difficult, but not impossible, to generate 
> stylesheets.
> However, ensuring that they do the rignt thing (on the 
> semanic level) is
> quite a headache. Therefore I have at least one or two tests for each
> stylesheet (e.g. I have a stylesheet that removes structures 
> which contain
> title nodes; than I have another stylesheet that extracts 
> only those who
> contain titles and I compare their numbers (number of 
> extraced structures)
> regarding the original set. If they add up they do very 
> probable the right
> thing - OR THEY ARE BOTH WRONG TO THE SAME DEGREE). I guess you get my
> problem here. It is really difficult and depends on the 
> problem. It can also
> go very easily completely wrong. If there are small errors it 
> might result
> in mistakes in the data which are almost impossible to find 
> (e.g. in very
> large data sets of 10000s of XML structures). 
> 
> My question here is: How do you verify your stylesheets? 
> 
> Is there software or methodlogy which deals with this 
> problem? I think, the
> incredibly flexiblity and power of XSLT is at the same time 
> its problem. It
> is very difficult to do the right thing. Just thinking and 
> being careful and
> checking the code 10 times does not help always... 
> 
> Perhaps somebody has references of methodologies or 
> books/papers written
> about this problem. Does somebody know good websites that contain some
> information about good practise and guidelines of doing good 
> stylesheets? A
> discussion is more than welcome and I think it would be right 
> place to have
> one....
> 
> Looking forward to interesting experiences, comments and suggestions.
> 
> Best Regards,
> Karl
> 
> -- 
> GMX DSL = Maximale Leistung zum minimalen Preis!
> 2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: 
> http://www.gmx.net/de/go/dsl

Current Thread