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 (https://github.com/MenteaXML/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

XSL-FO Meetup at XML Prague 2012

Inasmuch as XML Prague 2012 includes “Pre-conference Friday“, the W3C XML Print and Page Layout Working Group is looking to host a XSL-FO meetup before XML Prague on Friday, 10 February 2012. The format and content will depend on your feedback. Possible ideas include:

  • Update on the XSL-FO 2.0 work
  • ‘Ignite’ lightning talks on XSL-FO
  • XSL-FO tutorial

If you use Twitter, register your interest at the “XSL-FO meetup @ XML Prague 2012” page on Lanyrd.com, otherwise send me email.  If you have suggestions for the format or content, likewise add something to the Lanyrd page or send me email.

Page Regions in XSL-FO

Inasmuch as I used this new sequence of images in my recent XSLT and XSL-FO talk at XML Summer School 2011, here’s an outline of page regions in XSL-FO.

The fo:simple-page-master FO in XSL 1.1 defines the dimensions of a page. A document may have more than one fo:simple-page-master, and the same fo:simple-page-master may be used in multiple contexts. A fo:simple-page-master has up to five regions: fo:region-body, fo:region-start, fo:region-end, fo:region-start, and fo:region-end.  Only fo:region-body is required.  The adjacent figure shows one arrangement of the regions. Continue reading

xslide alive!

Inasmuch as you, like me, may have missed xslide’s “Template” menu when editing XSLT using Emacs’ nXML-mode, I’ve made available my “xslide2″ XSLT mode for Emacs that I’ve been using for a while.  This new xslide is a derived mode that uses nXML-mode for nearly everything and adds back some of the XSLT-specific parts of xslide.

Future development is happening on the Trac and Subversion for the xslide SourceForge project.  See https://sourceforge.net/apps/trac/xslide/wiki/WikiStart.

Websites returning

Inasmuch as I accidentally deleted most of my websites and this blog last night, my “Full backup of all your data to remote servers every day” webhost then only had a backup from 27 June, i.e., somewhere in the middle of my migrating between servers such that there was no backup for most of my sites.

The net result is (a) I will be paying a lot more attention to doing my own website backups in future; (b) I’m busy scraping pages from the WayBack Machine and Google’s cache to remake the web sites; (c) the graphics don’t feature in the caches, so they’ll take longer to get back; and (d) this blog’s styles disappeared along with everything else and is now using the current default. You probably won’t miss the blog styles all that much, but losing them left WordPress in a state where it was both configured to serve RSS and not configured to have the RSS link on the pages, with the result that it threw an error on each request and didn’t serve anything. Finding and fixing that just added to the effort.

So while the websites are mostly back, it will be a while before they’re pristine again. The http://www.mentea.net/ website design is due to be revamped real soon now, anyway, but I still need the old content in order to transfer it to the new layout.

New XSL-FO 2.0 Working Draft

Inasmuch as that was always the plan, the XSL-FO 2.0 Working Draft published yesterday (latest version always at http://www.w3.org/TR/xslfo20/) is the first to incorporate new FOs and properties from the previous “Design Notes” document into the text from the XSL 1.1 Recommendation. The new WD also features more extensive linking from FO, property, and function references to their definitions. Continue reading

Posted in XSL

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 (http://www.lesscss.org/), 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