[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: How to include a JavaScript snippet into htmlhelp files?
[sorry, if this mail is duplicated - the reqest/subscribe address on the oasis-open web page is wrong, so I'm not sure whether my posting has been dropped] 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
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]