Subject: Re: [xsl] 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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How do you prove that your XS, Roger L Costello cos | Thread | Re: [xsl] How do you prove that you, Wendell Piez wapiez@ |
[xsl] How do you prove that your XS, Roger L Costello cos | Date | Re: [xsl] How do you prove that you, Wendell Piez wapiez@ |
Month |