#1237 Customizing user.footer.content removes main.js script

output: webhelp
open
nobody
XSL (1066)
7
2012-04-26
2012-04-26
No

I added some footer content to my webhelp HTML pages. When I added an override template for user.footer.content I found that the JavaScript for my pages stopped working correctly. The default XSLT file for webhelp uses the user.footer.content template to import the common/main.js JavaScript file. Overriding it removed that import.

I fixed the problem by moving the script import to the start of the <body> element. I found that it didn't work if I imported the script in the <head> element with the other JavaScript. I'm not sure why. This works though and it doesn't interfere with user.footer.content:

<body>
<xsl:attribute name="onLoad">
<xsl:text>javascript:makeFeedbackLink();</xsl:text>
</xsl:attribute>
<xsl:call-template name="body.attributes"/>
<script type="text/javascript" src="common/main.js">
<xsl:comment></xsl:comment>
</script>
<div id="content" role="main">

I'm using docbook-xsl-ns-1.76.1 with DocBook 5.0. My processor is Saxon 6.5.5.

Discussion

  • Peter Desjardins

     
  • Peter Desjardins

    • labels: --> XSL
    • priority: 5 --> 7
     
  • Peter Desjardins

    The attached file is the one I modified for my own testing. If no one objects to the change, I can make it.

     
  • Kasun Gajasinghe

    The template user.webhelp.content.footer can be used to over-ride footer content. It's empty by default. The reason here is that webhelp already uses the user over-rides provided by (X)HTML stylesheets. So, we have added empty templates like the above to let the users over-ride things easily.

    Anyway, your usecase makes sense. I don't think of any reason why we shouldn't if it just works at the start of the <body> element.

     

Log in to post a comment.