Hi All,
It certainly is possible to unit test XSLT in a 'JUnit like manner'.
The approach we've take in UTF-X is to define the tests outside the
stylesheets. Each test contains two XML fragments (sequences), source
and expected. Source is transformed using the stylesheet under test
and becomes 'actual' (using the JUnit lingo). Both actual and
expected are converted into their canonical forms and compared.
When designing UTF-X we tried to support the extreme programming
test-first-design principle. UTF-X has a functionality which allows
you to render tests which works well for both HTML and XSL:FO
generating XSLTs. The idea is that you can write your test first,
visually inspect it, and only when happy with the result implement the
XSLT templates.
If interested please check http://utf-x.sourceforge.net
Cheers
Jacek
BTW: we have room for more developers on the team.
On Dec 14, 2007 11:16 PM, Mukul Gandhi
<gandhi(_dot_)mukul(_at_)gmail(_dot_)com> wrote:
I almost agree with Andrew, that it's not possible to unit test a XSLT
stylesheet, which is like JUnit testing.
I guess, Florent that your unit test scripts will duplicate XSLT code
from the *actual* stylesheet ? Whereas, ideal unit testing will be
(JUnit like) - the unit test script invokes the main stylesheet (which
doesn't have any testing code, i.e. it's pure) and supplies some data
to it (an input XML for e.g.), and do assertions.
--~------------------------------------------------------------------
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>
--~--