Re: [xsl] ANN: 'Testing XSLT' training course PDF available

Subject: Re: [xsl] ANN: 'Testing XSLT' training course PDF available
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Fri, 14 Dec 2007 19:20:06 +0530
On Dec 14, 2007 7:06 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> Clearly functions are ideal for unit testing because unlike templates they
> have no context dependencies.

Thanks Mike for reminding about this. I had a feeling, that unit
testing is better possible with XSLT 2.0 ...

>But I think you can do it with templates too.
> I often exploit the XSLT 2.0 feature that allows a stylesheet to be executed
> starting at a named template; you can insert a named template that is there
> solely for testing purposes, for example
>
> <xsl:template name="test-table-rendition">
>  <xsl:apply-templates select="(//table)[1]"/>
> </xsl:template>
>
> or if you prefer you can compare the output with expected results using
> deep-equal().

I would ideally like - Have the original stylesheet (which is
undergoing testing) *unmodified*.
Write a unit testing stylesheet (which is like 1 unit test), which can
test some aspect of the original stylesheet (like a function), or
possibly test the whole stylesheet as a unit (and use deep-equal()
function to compare the expected output with the received output - but
this seems not possible without inserting a named template in the main
stylesheet).

Your named template approach, will modify the main stylesheet, which
is unlike JUnit.

Ofcouse, we can live with some limitations :)

Please correct me if I am wrong ...

-- 
Regards,
Mukul Gandhi

Current Thread