Re: [xsl] junit test... for xslt2?

Subject: Re: [xsl] junit test... for xslt2?
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Mon, 8 Mar 2010 09:12:49 +0000
>  But for a few components, mostly template rules, diffing
> against an expected XML document is really what we need.

I disagree on this point - there are a few tools out there to compare
HTML output and they are prone to failing as you tweak the UI.  For
example, adding an extra div to hang a style off of and you break all
the tests. You then have to painstakingly add that new div to all of
"expected" samples.  Diffing XML would have the same problem.

If you want to enforce the structure, then you can use schema aware
transforms (including at the "unit" level you can add type definition
to templates), or just validate the result afterwards.

Ultimately though, for checking the "correctness" of the result of a
transform, I think you just need to execute XPaths against it, which
are more tolerant of subtle changes in the output.  That was the idea
behind xchecker, which then became running xquery and transforms to
overcome the limitations of what xpath can check.


--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread