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 “Page Regions in XSL-FO”

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 “New XSL-FO 2.0 Working Draft”

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 “CSS for the hierarchically minded”

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 ends on high note”

Saxon feature keys for initial template and mode

Inasmuch as a “feature key” is how you configure a Java JAXP XSLT processor, it’s good to see that Saxon 9.3 has added feature keys for setting the initial template and initial mode. In fact, Saxon has gone from 30 feature keys in Saxon 9.0 to 70 in 9.2 and now 79 in 9.3.

Where this becomes useful (outside of your own Java programs) is being able to specify the initial template and/or mode in the <xslt> task in Ant build files. Continue reading “Saxon feature keys for initial template and mode”