OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: user.head.contentend patch for docbook-xsl 1.62.4


I need to include a JavaScript code snippet into all HTML chunks
for CHM/htmlhelp.  This script is necessary for the MS-HTML Help
when printing "selected heading and all subtopics".  Without the
code snippet, other scripts (via <SCRIPT SRC=...> would not be
found by HTML Help and the look-and-feel of the print-out would
be wrong.  Bob gave me the very good hint to use the template
user.head.content, but unfortunately the JavaScript code has to
be below the HTML link elements, not before.  I therefore made
a patch introducing a new user.head.contentend, which fits
perfectly for me.  I use it only in (x)html/chunk-common.xsl,
maybe it would be better to use it in (x)html/graphics.xsl and
(x)html/titlepage.xsl as well.  The patch only adds 14 lines, so
please apply it to docbook-xsl.  Feel free to use a better name
for the template than user.head.contentend :-)

Usage example:

File fix.js:

<script language="JavaScript" type="text/javascript"><!--
function nul(){return}
  document.write('<'+'SCRIPT LANGUAGE="JavaScript" SRC="'+
  replace(new RegExp('::[\\\\/:](\\.\\.[\\\\/:])+'),'::/').
  replace(new RegExp('[^\\\\/:]+$'),'')+'other.js"><'+'/SCRIPT>');

In the XSL driver (thanks to Bob Stayton):

<xsl:template name="user.head.contentend">
  <link rel="StyleSheet" href="style/my.css"/>
  <xsl:copy-of select="document('../my.path/fix.js',/)"/>

The patch is attached.

W. Borgert


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]