Re: [xsl] Junit-type Framework for XSLT 2 Functions and Templates?

Subject: Re: [xsl] Junit-type Framework for XSLT 2 Functions and Templates?
From: Dave Pawson <dave-list@xxxxxxxxxxxxx>
Date: Mon, 16 May 2005 17:53:13 +0100
On Mon, 2005-05-16 at 09:42 -0500, Eliot Kimber wrote:
> I've started doing work with XSLT 2 and I'm finding that, with the new
> built-in function mechanism in XSLT 2, along with all the new built-in
> functions string processing and what not, that I'm writing more
> XSLT-level functions that I have in the past (in the past I would tend
> to write these functions as Java extension functions).

> I haven't pushed on it, but it would be ideal if there was some way to
> apply the sort of introspection approach that JUnit uses--that is, have
> a transform that processes itself in order to find the test case
> templates and run them, reporting success or failure. But I don't think
> there's any way to do this directly (because there's no evaluate()
> function in standard XSLT.
> 
> Any ideas about how best to proceed?

Definately not 'how best'. Maybe some ideas though.

Given a stylesheet that you import into others,
as a collection of your xslt functions.

Add a template, called if some param = some specific value,
which then proceeds to exercise the functions from that template?

In Python my main is simply there for test purposes.
I can normally do the same in Java for most classes.

Its a case of developing an approach that is generally applicable and
meets your needs?
 How about using a single, given input XML file as the test input data.
  Use that to trigger testing, then its content to exercise the
functions using the test templates? Yes, a little wasteful,
but I like the TDD approach.

regards DaveP. 

Current Thread