wrew ewrwe wrote:
Hi
I was wondering if there is any testing suite for style
sheets (XSLT and XSLFO).
I've written a few stylesheets for that purpose (only to
test XSLT, not XSL-FO). I didn't have a lot of free time to
work on them since a long time, but actually I thought to
release a first pre-version the next week. If you are
interested, you can download them from:
http://www.fgeorges.org/xslt-unit/xslt-unit.tar.gz
It is for XSLT 2.0. Take care it is a work in progress.
As for now, I think there is still a dependency on Saxon.
You can find an old page on XSLT Unit at:
http://www.fgeorges.org/xslt-unit/xslt-unit.html
But I wrote it a long time ago and the stylesheets evolved
since that time. The unit test langage allow you to test
the result of an sequence constructor. For example (see
test/hello-world.xts):
<test:test>
<test:expect select="'Hello, world!'" pred="eq"/>
<xsl:sequence select="hw:hello-world()"/>
</test:test>
Simple tests are grouped into test groups:
<test:tests id="hello-world-all">
<test:title>hello-world()</test:title>
<test:test>
<test:title>hello-world(), arity 0</test:title>
<test:expect test="$test:result eq 'Hello, world!'"/>
<xsl:sequence select="hw:hello-world()"/>
</test:test>
<test:test>
<test:title>hello-world(), arity 1</test:title>
<test:expect select="'Hello, Jeni!'" pred="eq"/>
<xsl:sequence select="hw:hello-world('Jeni')"/>
</test:test>
</test:tests>
The test suite is then transformed to an XSLT stylesheet.
That stylesheet is in turn used to produce an XML report,
recording the tests performed as well as their results. A
last transformation format the report to an HTML page:
$ saxon test/hello-world.xts \
src/test-suite-gen.xsl > \
test/test-hello-world.xsl
$ saxon test/hello-world.xsl \
test/test-hello-world.xsl > \
test/test-hello-world.xml
$ saxon test/test-hello-world.xml \
src/report-to-html.xsl > \
test/test-hello-world.html
There is also a driver to do all these steps at once:
$ saxon test/hello-world.xts src/driver.xsl
There are a lot of thing still to do, in particular
formating a nice HTML page or adding support for XSLT SA.
But I think it can already be usefull.
I'd be please to have feedback on it, if you try it.
Jeni Tennison has also such a tool, but I'm not able
to find it in her site right now. You can check
http://www.jenitennison.com/.
Regards,
--drkm
___________________________________________________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Profitez des connaissances, des opinions et des expériences des internautes sur
Yahoo! Questions/Réponses
http://fr.answers.yahoo.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>
--~--