Subject: [xsl] [ANN] xchecker From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Tue, 5 Jun 2007 12:03:02 +0100 |
As it's quiet today it seems like a good time to announce a little utility I've been working on recently that I've called "xchecker" (I don't really like the name and I came up with it! at least its slightly better than the original of 'CheckXML'...)
- test XML (or the XML result of a transform) using XPath, XSLT, XSD, XQuery, Relax NG in combination. - embed XPath 2.0 checks (and others) in XML Schema
The relevant topic for this list is to use xchecker as a test framework for XSLT. To do that you create a Check Config with a transform subject:
<transform xml="xml/books.xml" xslt="xslt/books.xslt" result="result/output.html"> <check>/html/head/title = 'Books by publisher'</check> <check>exists(/html/head/meta)</check> </transform>
xchecker will apply the transform (using Saxon) and then evaluate each <check> on the result. In order for a check to pass, xchecker looks for the following:
- For XML Schema / Relax NG the document should validate - For XSLT / XQuery checks a single 'true' should be the result - For XPath a sequence of items can be returned with each one being 'true'
Any non-'true' values are returned as the failure message, so you can re-write your tests to be a little more informative in the event of a failure:
<check>if (/html/head/title = 'Books by publisher') then 'true' else concat('Unexpected title:', /html/head/title)</check>
cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] [ANN] DIY Framework based on , Martynas Jusevicius | Thread | [xsl] Character Report Overflow Pag, Matt |
[xsl] [ANN] DIY Framework based on , Martynas Jusevicius | Date | [xsl] Character Report Overflow Pag, Matt |
Month |