[xsl] tennison-tests: trying to get the sample working

Subject: [xsl] tennison-tests: trying to get the sample working
From: Darren Wheatley <darren@xxxxxxxxxxxx>
Date: Tue, 26 Aug 2008 01:38:49 +0100
Hi,

I'm interested in unit testing XSL transformations, and so have been trying to get the tennison-tests code from Sourceforge working.

It's pretty old now, and there doesn't seem to be any activity on the mailing lists.

What I'm trying to do is to run an XSL transformation on a sample XML input file, and then check the output XML file against a previously defined XML file.

In the doc for tennison-tests it says this should be possible with something along these lines:


test-1.xsl:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform
" xmlns:test="http://www.jenitennison.com/xslt/unit-test";>
<xsl:import test:stylesheet="" href="./mytransformation.xsl"/>
<xsl:import href="./Software/tennison-tests/main/src/xslt/tests- utils.xsl"/>
<test:suite>
<test:tests>
<test:test>
<test:title>transform-1</test:title>
<test:context href="./input1.xml"/>
<test:expect href="./output1.xml"/>
</test:test>
</test:tests>
</test:suite>
</xsl:stylesheet>


- where mytransformation.xsl is the XSL transformation that I want to test using input1.xml as the input file, and checking the output against output1.xml. This is in a file called "test-1.xsl".

I've put together a quick ant build.xml (learning ant as I go so this might be very wrong):


build.xml:


<project name="MyProject" default="test" basedir=".">
<description>
simple example build file
</description>
<!-- Execute the tests for a single run -->
<target name="test">
<taskdef name="xslttest"
classname="com.jenitennison.xslt.unittest.XSLTTest"
classpath="./ant-xslttest-1.0.0.jar" />
<xslttest src="./Software/tennison-tests/main/src/xslt" target="./" generate="false">
<fileset dir="./">
<include name="test-1.xsl" />
</fileset>
<factory name="net.sf.saxon.TransformerFactoryImpl" />
</xslttest>
</target>
</project>



When I run ant I get the following error:


Buildfile: build.xml

test:
[xslttest]
javax .xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl
[xslt] Processing /client/Test Cases/test-1.xsl to ./test-1- RESULT.xml
[xslt] Loading stylesheet /client/Test Cases/test-1.xsl
[xslt] /client/Test Cases/Software/tennison-tests/main/src/xslt/ tests-utils.xsl:19: Fatal Error! To perform validation, a schema-aware XSLT processor is needed
[xslt] Failed to process /client/Test Cases/test-1.xsl


BUILD FAILED
/client/Test Cases/build.xml:16: javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected.


FYI, I'm using Saxon 9 and Ant 1.7 on a Mac running Leopard 10.5.4. I have added saxon9.jar to $HOME/.ant/lib.

Any ideas why this might be failing?

Thanks

D.

Current Thread