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

Subject: RE: [xsl] tennison-tests: trying to get the sample working
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 26 Aug 2008 09:58:03 +0100
I've taken a quick look at this, but I don't know the code and it's not easy
to debug. It's making calls directly into the Ant XSLTProcess code which I
don't understand well enough. So I can't see why it is requesting validation
of the input file. You'll have to either debug the Java yourself, or get
help from someone who wrote or understands the code.

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Darren Wheatley [mailto:darren@xxxxxxxxxxxx] 
> Sent: 26 August 2008 01:39
> To: XSL List
> Subject: [xsl] tennison-tests: trying to get the sample working
> 
> 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