Schematron Testing Framework

Inasmuch as a suite of Schematron tests contains many contexts where a bug in a document will make a Schematron assert fail or a report succeed, it follows that for any new test suite and any reasonably sized but buggy document set, there will straight away be many assert and report messages produced by the tests.  When that happens, how can you be sure your Schematron tests all worked as expected?  How can you separate the expected results from the unexpected?  What’s needed is a way to characterise the Schematron tests before you start as reporting only what they should, no more, and no less.

stf ( is a XProc pipeline that runs a Schematron test suite on test documents (that you create) and winnows out the expected results and report just the unexpected.  stf uses a processing instruction (PI) in each of a set of (typically, small) test documents to indicate the test’s expected asserts and reports: the expected results are ignored, and all you see is what’s extra or missing.  And when you have no more unexpected results from your test documents, you’re ready to use the Schematron on your real documents. Continue reading

CSS for the hierarchically minded

Inasmuch as both HTML and XML markup – being descended from SGML – support a nested, hierarchical structure and as CSS allows, even promotes, a stream-of-consciousness style of coding, there can be a tension between the two approaches.

To put it another way:

  • If you want different styles in a couple of contexts that depend on the type of several levels of ancestor, then you get to put all those ancestors in the CSS selectors for each of those styles;
  • If you want to use the same colour in multiple different styles, then, by golly, you get to enter the same color value in each of them (and if you want to change it later, you get to find them all again to do it); and
  • If you want to use the same set of styles in multiple contexts – say, use rounded corners multiple places and with bigger radii on the outermost corners – then you get to repeat the same set of styles while jiggering their values every place that you want them.

The CSS soon gets to the point that only a machine can reliably work out the cascading and so we require tools such as Firebug to make sense of it and present it to us in ways that we can understand.

I have previously implemented a system for a client where the template CSS file is wrapped in an XML element and contains empty elements for each of the values of color properties so the all-XML processing system can ‘skin’ the stylesheet by substituting the preferred color values and outputting proper CSS on the way to making the HTML, but that was adding complexity, not taking it away.

Enter LESS (, the “dynamic stylesheet language”. LESS is pretty much CSS as it should have been, since it elegantly solves the gripes listed above, and more besides. Continue reading

XML Summer School 2011 ends on high note

Inasmuch as my final “XSLT and XSL-FO toolbox of tips and tricks” session was well received, XML Summer School 2011 finished on a high note. My other sessions, “Developing and Testing in XSLT” with Jeni Tennison in the “XSLT/XQuery” track and a five-minute Ignite-format talk on EPUB, also went well, but it was that final talk in the “Publishing” track that got the most visible reactions. Continue reading

XML Summer School 2011

Inasmuch as I was already asked to be on the Publishing track at XML Summer School 2011, I was then invited to co-teach “Developing and Testing in XSLT” with Jeni Tennison in the XSLT and XQuery track, so I’m pleased that I’ll be teaching two sessions at the XML Summer School in St Edmund Hall, Oxford University, on 18-23 September 2011. (Early bird discount ends 30 June 2011.)

My sessions are but 1/4 of their respective tracks, but I’ll be in the room for the entirety of each track and, indeed, like all Faculty at the XML Summer School, I’ll be around all week. Continue reading

Converting RNG to RNC

Inasmuch as the customised version of the “xmlspec” schema being used for the next version of the XSL spec is maintained in RELAX NG XML syntax (RNG) and Emacs’s nXML-mode only uses RELAX NG compact syntax (RNC), I yet again wanted to convert a schema from RNG to RNC.  As you would expect, there’s more than one way to do it. Continue reading

XML Prague 2011 a success

Inasmuch as the EPUB: Chapter and Verse talk went down well and, for many people, the Saturday evening libations at The Strahov Monastic Brevery went down even better, I judge XML Prague 2011 to be a success for me (and for my co-author, Mark Howe) and for Mentea and also a success in its own right.

Several people made approving comments about the talk, which was good (some even commented on last year’s talk, which, since this showed they still remembered it, was even better).   The best comment about this year’s though is probably @Innovimax‘s tweet:

Tony is a real 21th century XML Monk! He sponsored the Beer Station at #xmlprague and works on nicely printing bibles. #consideringJoining

Continue reading

EPUB: Chapter and Verse

Inasmuch as XML Prague is the best XML conference in Europe that I know of, I am pleased to be again co-presenting with Mark Howe of Cyberporte at XML Prague 2011 on 26-27 March. Our talk this year is EPUB: Chapter and Verse:

The link between the Bible and publishing technology is at least as old as Gutenberg’s press. 400 years after the publication of the King James Bible, we were asked to convert five modern French Bible translations from a widely-used ad hoc TROFF-like markup scheme used to produce printed Bibles to a standard XML vocabulary, and then to EPUB. We opted to use XSLT 2.0 and ant to perform all stages of the conversion process. Along the way we discovered previously unimagined creativity in the original markup, even within a single translation. We cursed the medieval scholars and the modern editors who have colluded to produce several mutually incompatible document hierarchies. We struggled to map various typesetting features to EPUB. E-Reader compatibility made us nostalgic for browser wars of the 90s. The result is osisbyxsl, a soon-to-be open source solution for Bible EPUB origination.