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] 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

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]