[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: javascript problem

Subject: Re: javascript problem
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Thu, 18 Jul 2002 10:25:24 -0400
xsl and javascript document.write
[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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.