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:
http://www.sagehill.net/docbookxsl/InsertExtHtml.html

For example:

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

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

</xsl:template>

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:

http://www.sagehill.net/docbookxsl/BodyAtts.html

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

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- 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
seemed
> that some folk were advocating using javascript to massage a DocBook
document
> to, say build a table of contents or an index on the fly, insert them into
the
> DOM and then render them with CSS.
>
> I was thinking about this when I realised that I don't know how to embed
or
> 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]