[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] javascript problem


Subject: Re: [xsl] javascript problem
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Thu, 18 Jul 2002 10:25:24 -0400

[Paul Kelly]
>

This is not an xslt issue, it is a web page design issue.  You should make
sure that you get your HTML working right first, ***before*** trying to
create it with a stylesheet.

> Can someone please tell me why this script will not execute:
>
> <head>
> <xsl:copy-of select="document('meta')/meta" />
> <title><xsl:value-of select="page/@title"/></title>
> <script language="JavaScript">
> {
> document.write("&lt;link rel='stylesheet' href='css.css'
> type='text/css' /&gt;");
> }
> </script>
> </head>
>
>

This does not execute because it is in the head of the document.  The only
way to be sure when it will execute,  is to define a function and call that
function from some event, like the onLoad event defined in the body element.
In this case, it is a good thing you do not get results because writing to
the document after it has completed could wipe it out completely, including
the code that writes to the document.

> But this one will (it's further down inside the body of the html output):
>
> <script language="JavaScript">
>   {
> document.write("&lt;hr width='10' /&gt;");
> }
> </script>
>

This executes when the page builder works its way down to this part of the
page.  But why not just put in the html directly at this point?  You are
only putting in a simple html element.

Cheers,

Tom P


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords