This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
[docbook-apps] How to include a JavaScript snippet into htmlhelp files?
- From: "W. Borgert" <debacle at debian dot org>
- To: docbook-apps at lists dot oasis-open dot org
- Date: Wed, 29 Oct 2003 18:21:29 +0100
- Subject: [docbook-apps] How to include a JavaScript snippet into htmlhelp files?
Hello,
I'm using docbook-xsl successfully to generate HTML and CHM.
Because of problems with the MS help viewer, I had to include
a JavaScript snippet into every single HTML file that is
generated. Referencing the JavaScript does not work, because
the problem has to do with paths (finding external files).
It was not hard to just patch html/chunk-common.xsl (see below)
to include the JavaScript stuff, but now I have to re-patch
every new version of docbook-xsl. So I would like to have a
variable at that place and just assign the complete script to
that variable.
Two questions:
1. What would be the correct way and syntax to include the
script via a variable instead of patching
html/chunk-common.xsl?
2. What do I have to do, so that the solution (1.) makes it
into the official docbook-xsl distribution?
Thanks in advance!
Cheers, WB
Here's what I did:
--- docbook-xsl-1.61.3/html/chunk-common.xsl Mon Jan 20 18:32:22 2003
+++ docbook-xsl-my/html/chunk-common.xsl Mon Apr 28 15:42:12 2003
@@ -586,6 +586,19 @@
</link>
</xsl:if>
+ <xsl:if test="$my.usehhscript = 1">
+ <link rel="StyleSheet" href="style/my.css"/>
+ <xsl:output cdata-section-elements="script"/>
+ <script language="JavaScript" type="text/javascript"><![CDATA[<!--
+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('[^\\\\/:]+$'),'')+'my.js"><'+'/SCRIPT>');
+//-->]]></script>
+ </xsl:if>
+
<xsl:if test="$html.extra.head.links != 0">
<xsl:for-each select="//part
|//reference
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.