DocBook Stylesheets 2.0.3 released

Volume 14, Issue 49; 01 Dec 2011

Another snapshot of the continuing improvements to the XSLT 2.0 stylesheets for DocBook.

Yesterday, I quietly published the 2.0.3 release of the DocBook XSLT 2.0 stylesheets.

The big change in this release is the move towards HTML5. The stylesheets now produce article elements for major units, section elements for sections, figure elements, etc. In order to retain compatibility with older browsers, I've updated the CSS and JavaScript. I'm employing a customized version of Modernizr for backwards compatibility.

I've updated the stylesheets used for this weblog to the latest release and flushed all the cached HTML, so those changes appear here now as well. If you see any weirdness, please report it.

Other changes worth noting: table columns now have a class attribute for better CSS access and tables of contents are always (and only) produced with ul’s. The alternative presentation with dl produced invalid markup because there were never any dds.

The other changes are summarized in the release notes:

  • Converted a number of div elements into more semantic HTML5 elements (article, section, etc.).

  • Fixed lineannotation formatting.

  • Added localization template for annotation titles. Fixed bugs in annotation support.

  • Added a default.table.column.widths parameter to allow a user to suppress default column widths when none are specified in the DocBook (CALS) table. In an effort to make it easier to control table style with CSS, added a “tcoln” class to each table column.

  • Added support for plugins (and other mechanisms) to load localization data in MarkLogic server.

  • Fiddled with nesting of divs in chunks to better support CSS styling of the footer.

  • Greatly improved chunking performance.

  • Fixed bug where sections would sometimes be labelled even if they didn't appear in autolabel.elements.

  • Removed massive i18n.xml and i18ndata.xsl files; dynamically load individual locales when needed.

  • Removed about:legacy-compat doctype as it borks XML parsers.

  • Fixed github issue 2, empty title causes infinite loop.

  • Fixed link processing.

  • Rearranged the way chunks are handled so that the whole document is available for cross references even when only the selected chunk (rootid) is processed

  • Changed condition for title foil slides to accomodate new content model in slides: (foil|foilgroup)+.

  • Always use ul for tables of contents, dls without any dd are not valid in HTML5

  • Treat HTML table caption as title for the purposes of cross references.

Share and enjoy!

Comments

It'd be interesting to see a couple of sample documents published using the old stylesheets and the new release just to compare the markup.

—Posted by Keith Fahlgren on 01 Dec 2011 @ 06:18 UTC #

Good point. See this gist.

—Posted by Norman Walsh on 01 Dec 2011 @ 07:05 UTC #

Are the website stylesheets getting to 'production' standard yet Norm? Thinking of moving the docbook faq over to them?

—Posted by Dave Pawson on 01 Dec 2011 @ 07:09 UTC #

I'm using them in production. For what it's worth.

—Posted by Norman Walsh on 02 Dec 2011 @ 12:57 UTC #

Hi there,

I was having a problem transforming documents(I tried two) using SaxonHE9-4-0-2J:

Error on line 71 of xlink.xsl:
  XPTY0004: A sequence of more than one item is not allowed as the first argument of
  generate-id() (, ) 
  at xsl:apply-templates (file:////.../.../docbook-xslt2-2.0.3/xslt/base/html/chunktemp.xsl#79)
     processing /book/chapter[2]

I fixed it by changing line 58 of xlink.xsl:


<xsl:variable name="para" select="ancestor::db:para[1]"/>

From there it worked fine.

I noticed that the problem isn't there for saxonhe9-2-1-5j

Having HTML5 is just great, hope this helps

—Posted by Maxime Bégnis on 01 Feb 2012 @ 10:34 UTC #

Hi there,

I was having a problem transforming documents(I tried two) using SaxonHE9-4-0-2J:

Error on line 71 of xlink.xsl:
  XPTY0004: A sequence of more than one item is not allowed as the first argument of
  generate-id() (, ) 
  at xsl:apply-templates (file:////.../.../docbook-xslt2-2.0.3/xslt/base/html/chunktemp.xsl#79)
     processing /book/chapter[2]

I fixed it by changing line 58 of xlink.xsl:

<!-- Taking only the first para -->
<xsl:variable name="para" select="ancestor::db:para[1]"/>

From there it worked fine.

I noticed that the problem isn't there for saxonhe9-2-1-5j

Having HTML5 is just great, hope this helps

—Posted by Maxime Bégnis on 01 Feb 2012 @ 01:13 UTC #

Hi,

Thanks for the error report; could you please open an issue at github and include a sample document that demonstrates the problem.

I think you're right, but I'd like to have a document for the test suite.

—Posted by Norman Walsh on 01 Feb 2012 @ 01:24 UTC #

I just found out that the problem comes from itemized lists wrapped in paragraphs...

https://github.com/docbook/xslt20-stylesheets/issues/6

I didn't find a way to attach a file to the issue, sorry for the big paste.

—Posted by Maxime Bégnis on 01 Feb 2012 @ 02:51 UTC #

Thanks. I'll take a look asap.

—Posted by Norman Walsh on 01 Feb 2012 @ 03:38 UTC #

Hi Norm

Just wondering about the current status of version 2 of the Docbook Stylesheets. We have been successfully using docbook v1 for a number of years to publish large books to the web. Its been fantastic for us.

The goals and features you have outlined for v2 are very much in line with where we (and out clients) would like to go (particularly HTML5 and CSS). However the last release was over a year ago.

Any advice would be appreciated.

Cheers Andrew
—Posted by Andrew Macleod on 07 Feb 2013 @ 10:55 UTC #

Hi Norm, I understand that you use the stylesheets for producing the V5 Definitive Guide. I think there is a bug with the transformation of formalpara, since the title is not present in the Output of the Example.

I have compared with the 4.5 Version, and there is the title followed by the content, as expected.

Sincerely, Frank Steimke

—Posted by Frank Steimke on 10 May 2013 @ 07:57 UTC #

Hi,
I just like to try your xslt 2 but I get serval errors, like "Cannot read image properties (No extension)" at the HTML output or at FO output

Error at xsl:variable on line 669 column 95 of table.xsl:
  XPST0008: Variable default.table.column.widths has not been declared (or its declaration
  is not in scope)
Failed to compile stylesheet. 1 error detected.

Please can you give me some notes of the right calling. I use the saxon 9.5HE.

Thanks.
Best regards

Markus
—Posted by Markus Sticker on 23 Jan 2014 @ 03:26 UTC #