Andy Chambers a écrit :
> I'm trying to create a little test system for checking the content of
Why don't you try an existing one ?
Have a look here :
http://reflex.gforge.inria.fr/xunit.html
> xml documents. I'd like to have files something like this....
>
> <xunit fo="http://www.w3.org/1999/XSL/Format">
> <test name="sample ok"
> xpath="//fo
age-sequence[1]/@master-reference"
> expected="A4-portrait"/>
> <test name="sample fail"
> xpath="/non/existent/path"
> expected="sdlfd"/>
> </xunit>
<!--first, let's use a convenient root element
for importing the modules to use ; the last
namespace URI doesn't refer to a module,
it's the ns URI expected for accessing inside
the XSLFO document-->
<xcl:active-sheet
xmlns

cl="http://ns.inria.org/active-tags/xcl"
xmlns:io="http://ns.inria.org/active-tags/io"
xmlns

unit="http://reflex.gforge.inria.fr/xunit.html"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!--let's define our test case-->
<xunit:test-case name="test-case" label="My test case">
<!--parse the input XSLFO to test ;
it can be as well the output of an XSLT transformation
as a DOM tree or SAX events-->
<xcl

arse name="fo" source="file:///path/to/file.fo"/>
<!--assert that we have what is expected-->
<xunit:assert-string-equals result="A4-portrait" expected="{
string( $fo//fo

age-sequence[1]/@master-reference ) }"/>
<xunit:assert-string-equals result="an other value" expected="{
string( $fo//fo:an/fo

ther/fo

ath ) }"/>
</xunit:test-case>
<!--generate an XML report-->
<xunit:merge-reports name="Summary of XSLFO tests" source="{
io:file( '.' ) }"
output="{ io:file( 'my-error-report.xml' ) }"/>
<!--the last step could be transforming the XML report generated
in HTML ; if you want to use the stylesheet I used in the
XUnit tutorial, just let me know (I should add it to the
bundle in the next release of the engine)-->
</xcl:active-sheet>
If you already know XPath and XSLT, you should understand the above
script ; unlike XSLT it's a script that accept several instructions set,
like XSLT it's XPath centric ; there are other little variations, have a
look at the tutorials if you want to learn more
--
Cordialement,
///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
-----------------------------
http://reflex.gforge.inria.fr/
Have the RefleX !