DITA-OT1.5 M15 (Feature Request ID: 2698921)
Thanks to Robert Anderson (Feature Request ID: 2698921) you can now add attributes to the body tag in HTML output.
I wanted to use the http://code.google.com/p/google-code-prettify/ code highlighter and was able to get the script calls in using args.hdf/hdr, and use outputclass=prettyprint into the codeblock tag. The last thing was to modify the body tag to run the script when the page loaded. I modified the XSL to make it conditional, so it didn't modify the tag on pages that didn't actually need the script:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon">
<xsl:import href="dita2xhtml.xsl"></xsl:import>
<xsl:template match="*" mode="addAttributesToBody">
<xsl:if test='count(//codeblock) > 0'>
<xsl:attribute name="onload">prettyPrint()</xsl:attribute>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
- pondj's blog
- Login to post comments
- 8310 reads