[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xslt test automation

Subject: RE: xslt test automation
From: <vojtech.toman@xxxxxxx>
Date: Tue, 30 Nov 2010 07:56:33 -0500
RE:  xslt test automation
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.