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

Re: How do you prove that your XSLT programs are corre

Subject: Re: How do you prove that your XSLT programs are correct?
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Apr 2022 16:52:19 -0000
Re:  How do you prove that your XSLT programs are corre
You're not talking about proving correctness here, you're talking about
testing.

If you want to prove properties of the stylesheet statically, for example that
the output will conform to a particular schema, then consider writing
schema-aware XSLT code. (However, I'm very reluctant to talk about proviing
"correctness". You can prove a hypothesis about the behaviour, but you can't
prove that such behaviour will be considered "correct" in the real world.)

For testing, XSpec is a popular framework, which roughly does what you
describe in (2). This is also how the W3C XSLT test suite at
https://github.com/w3c/xslt30-test works. (That test suite, of course, is
geared more to coverage of constructs in the XSLT language, so the details
will be rather different from tests of a user stylesheet, but the principle is
much the same.)

The biggest weakness I see in the way most users test their stylesheets is
that they use far too few different source documents to achieve good coverage
of the logic, especially the error cases.

Michael Kay
Saxonica

> On 14 Apr 2022, at 17:08, Roger L Costello costello@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi Folks,
>
> Scenario: You write an XSLT program that takes some input and outputs XML.
You want to be sure that your XSLT program is correct.
>
> As I see it, there are two ways to help ensure the correctness of an XSLT
program :
>
> 1. Pepper the XSLT program with assert statements, using xsl:assert.
>
> 2. Create a second XSLT program that queries the XML that was generated by
the first XSLT program. This second XSLT program contains a series of XPath
expressions to check various parts of the XML.
>
> Which of those do you use? Or do you use both? Or do you use something else?
>
> How do you ensure the correctness of your XSLT programs?
>
> /Roger

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.