This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[docbook-apps] user.head.contentend patch for docbook-xsl 1.62.4


Hello,

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}
if(null!=document.styleSheets&&0<document.styleSheets.length)
  document.write('<'+'SCRIPT LANGUAGE="JavaScript" SRC="'+
  document.styleSheets[0].href.
  replace(new RegExp('::[\\\\/:](\\.\\.[\\\\/:])+'),'::/').
  replace(new RegExp('[^\\\\/:]+$'),'')+'other.js"><'+'/SCRIPT>');
//--></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',/)"/>
</xsl:template>

The patch is attached.

Cheers,
W. Borgert

Attachment: contentend.patch
Description: Binary data

To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]