My experiments succeded, so that from one script I can import others. This 
means I can linenmber and syntax highlight with Prism. The built in through 
Saxon transform never worked. So I returned to xsltproc which is also way 
faster.

I got a couple of nice customizations in place to support Prism.js

One peculiar caveat though, type=module does NOT work with xhtml, only with 
html. My webdev eyes get sore from seeing the html output. Not pretty, but it 
works.

/Niels

Greetings
Niels Müller Larsen
Programmer/Teacher



> On 20 Apr 2020, at 03.33, Bob Stayton <[email protected]> wrote:
> 
> 
> Hi Niels,
> 
> I'm not sure I understand if this is working for you.  Multiple scripts are 
> allowed as a space-separated value to the stylesheet parameter html.script, 
> and they each generate a <script> element.  They would all get the same 
> @type, though.
> 
> In any case, if you need more than the simple script handling provided by the 
> params, there is an empty utility template named 'user.head.content' that you 
> can customize instead.  It is called within <head> to output whatever custom 
> head content you need.  It is described here:
> 
> http://www.sagehill.net/docbookxsl/HtmlHead.html
> 
> Bob Stayton
> [email protected]
> On 4/19/2020 2:52 AM, Niels Müller Larsen wrote:
>> Thanks Bob. Are there any details you don’t have handy?
>> 
>> I notice “a script” at the link location. Not “the script”.
>> I tested if you could include more than one. Didn’t work. So the 
>> “type=‘module’ will allow you to import other scripts to help the one 
>> allowed in docbook. This supports a better structure in the necessary js 
>> code.
>> In css you can import other sheets. In js you can do that only with 
>> type=module.
>> At present I am trying to interface my pages with prism.js for syntax 
>> highlighting. Prism is a script and a css sheet.
>> 
>> But thanks again
>> 
>> /Niels
>> 
>> Greetings
>> Niels Müller Larsen
>> Programmer/Teacher
>> 
>> 
>> 
>>> On 19 Apr 2020, at 07.53, Bob Stayton <[email protected]> wrote:
>>> 
>>> 
>>> If you just want to change the @type attribute value for all scripts, 
>>> there's a param for that:
>>> 
>>> http://docbook.sourceforge.net/release/xsl/current/doc/html/html.script.type.html
>>> 
>>> Bob Stayton
>>> [email protected]
>>> On 4/18/2020 5:01 AM, Niels Müller Larsen wrote:
>>>> Hi all
>>>> You may customize docbook to include a certain javascript into all your 
>>>> generated html files (chunked) by including
>>>> 
>>>>     <xsl:param name="html.script">nmlQuery.js</xsl:param>
>>>> 
>>>> is there a way you can make this appear in the html as
>>>> 
>>>> <script src="nmlQuery.js" type="module"/>
>>>> 
>>>> it would be very convenient by allowing you to structure your js in a more 
>>>> moderne way.
>>>> 
>>>> BTW ...type="text/javascript" is not necessary in this day and age.
>>>> 

Reply via email to