OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook] XML + Javascript? was:[Whatever happened too CSS+XML]

You can use the user.head.content template to insert script elements.  See:

For example:

<xsl:template name="user.head.content">
  <script src="scripts/website.js" type="text/javascript"></script>

  <script language="javascript">
     Javascript code goes here.
   // </xsl:comment>


Getting the browser to execute the code is another thing.  The reference
above describes how to use a processing instruction to insert something in
the output. You can also insert an onLoad attribute in the body element to
do something on loading.  See:


Depending on what you want the Javascript code to do, you may have to do
other customizations.

Bob Stayton
Sagehill Enterprises
DocBook Consulting

----- Original Message ----- 
From: "Doug du Boulay" <doug.duboulay@gmail.com>
To: <docbook@lists.oasis-open.org>
Sent: Friday, January 13, 2006 11:56 PM
Subject: [docbook] XML + Javascript? was:[Whatever happened too CSS+XML]

> I was just rereading the CSS+XML thread from back in November and it
> that some folk were advocating using javascript to massage a DocBook
> to, say build a table of contents or an index on the fly, insert them into
> DOM and then render them with CSS.
> I was thinking about this when I realised that I don't know how to embed
> execute javascript from within XML.
> I know that for some browsers you can apply CSS using a leading
>   <?xml version="1.0" ?>
>   <?xml-stylesheet href="docbook-css/driver.css" type="text/css" ?>
> to render an arbitrary XML document such as DocBook, but
> what is the equivalent to include javascript and have it execute?
> In HTML you would just say
>   <script src="scripts/website.js" type="text/javascript">
> or
>   <script language="javascript">
>   <!--
>   // -->
>   <script>
> I'm sure that javascript could be added in a DocBook element too, but
> how would the browser ever know it had to execute it?
> Puzzled.
> Doug
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-help@lists.oasis-open.org

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]