Subject: RE: [xsl] xslt test automation From: <vojtech.toman@xxxxxxx> Date: Tue, 30 Nov 2010 07:56:33 -0500 |
As an XProc implementer, I have found the XProc Test Suite format (http://tests.xproc.org) very useful for XSLT testing. By writing a simple XProc pipeline (consisting of a single p:xslt step) you can easily create tests that apply your stylesheet with different input data, different parameters, or different initial mode/template. Stylesheets that produce multiple output documents (via xsl:document) are also supported. The test format allows you to compare the result of the pipeline with the expected output. Obviously, you can also further inspect/manipulate the XSLT input/output with XProc if you want. The main limitation of this approach is that it only works with XML data. If your stylesheet produces results that are not well-formed XML, processing those may be quite challenging in XProc. The example test below should give you an idea of how this looks like (you can see more examples at http://tests.xproc.org/testsuite/): <t:test xmlns:t="http://xproc.org/ns/testsuite" xmlns:p="http://www.w3.org/ns/xproc"> <t:title>Test xslt-001</t:title> <t:input port="source"> <document> <title>Some Title</title> <para>Some paragraph.</para> </document> </t:input> <t:input port="style"> <t:document href="style.xsl"/> </t:input> <t:pipeline> <p:pipeline version="1.0" name="pipeline"> <p:input port="style"/> <p:xslt> <p:input port="stylesheet"> <p:pipe step="pipeline" port="style"/> </p:input> </p:xslt> </p:pipeline> </t:pipeline> <t:output port="result"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Some Title</title> </head> <body> <h1>Some Title</h1> <p>Some paragraph.</p> </body> </html> </t:output> </t:test> Regards, Vojtech -- Vojtech Toman Consultant Software Engineer EMC | Information Intelligence Group vojtech.toman@xxxxxxx http://developer.emc.com/xmltech
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xslt test automation, Philip Fearon | Thread | Re: [xsl] xslt test automation, Dave Pawson |
Re: [xsl] Search In Multiple Files, Hermann Stamm-Wilbra | Date | Re: [xsl] xslt test automation, Dave Pawson |
Month |