Test definition to XSLTUnit

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:alias="http://www.jezuk.co.uk/xcrete/xslt-alias"
    xmlns:exsl="http://exslt.org/common"
    extension-element-prefixes="exsl"
    xmlns:xsltu="http://xsltunit.org/0/"
    xmlns:xc="http://www.jezuk.co.uk/xcrete/test-def"
    version="1.0">
  <xsl:namespace-alias stylesheet-prefix="alias" result-prefix="xsl"/>

...

  <xsl:template match="xc:test" mode="xslt">
    <xsltu:test id="{@id}">
      <alias:call-template name="xsltu:assertEqual">
        <alias:with-param name="id" select="{@id}"/>
        <alias:with-param name="nodes1">
          <alias:apply-templates>
            <xsl:copy-of select="xc:apply-templates/@*|xc:apply-templates/node()"/>
          </alias:apply-templates>
        </alias:with-param>

        <alias:with-param name="nodes2">
          <xsl:copy-of select="xc:expected/*|xc:not-expected/*"/>
        </alias:with-param>
      </alias:call-template>
    </xsltu:test>
  </xsl:template>
</xsl:stylesheet>
We can use the magic of XSLT to generate the XSLTUnit source from this minmal test definition.

Bingo! Problem solved.

Our test process is now - style the test definition to generate the XSLTUnit stylesheet, then style the test data with that XSLTUnit stylesheet to get the test results.

The XSLTUnit stylesheet is dependent on the test definition. Change the test def, and we must regenerate the XSLTUnit test.

Let's get Ant to do that for us.