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

RE: ANN: 'Testing XSLT' training course PDF available

Subject: RE: ANN: 'Testing XSLT' training course PDF available
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 14 Dec 2007 13:36:28 -0000
RE:  ANN: 'Testing XSLT' training course PDF available
>   Mmh, what do you think, in this context, about something 
> that looks like the following:
> 
>     <t:tests>
>       <t:title>Fibonacci</t:title>
>       <t:test>
> 	<t:assert expect="0" select="my:fibonacci(0)"/>
>       </t:test>
>       <t:test>


Clearly functions are ideal for unit testing because unlike templates they
have no context dependencies. 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().

Having said that, my main use for this technique is with a multi-phase
stylesheet, allowing each phase to be tested independently of the others.

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

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.