Re: XSL and Javascript to set new window parameters

Subject: Re: XSL and Javascript to set new window parameters
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Fri, 10 Nov 2000 04:26:11 -0800
The best way (or just an alternative) to handle's is to put it
in a function and call it from the click event.  It has been my experience
that you get inconsistent results calling directly.

so you could have a javascript function that is something like this (you may
want to parametize more stuff):

function gotoURL (thePage){,'new','toolbars=no,scrollbars=no')

then in your xsl/xml transform you would write out a line that looks like:

<a href="javascript:gotoURL('default.html');">Home</a>

note: you can call mutliple functions like this:

the XSL could look like this:

<!-- &srv_uri; is an entity that defines the fully qualified root of the
site -->
&lt;a href="javascript:gotoURL('&src_uri;/<xsl:value-of
<xsl:value-of select="$linkText"/>
(probably should be all one line...I separated to make it a little more

By the way, you can put all of your javascript functions in a separate file
and include it (client-side) so you don't have to go through all the CDATA
or escaping of your functions for the XSL transfomation.  You can do
something like this:

// &js_uri; is an entity that defines the path to the Javascript files
<script language="JavaScript" src="&js_uri;/scripts.js"></script>

> > I have an XSL sheet that constructs a simple table with links created
from a
> > set of ID's taken from the XML.
> > Creating the link is straighforward but I want to ensure that the link
> > opened in a new window with specific parameters.  I know how to do this
> > Javascript using the code
> >
> > onClick="'default.html','new','toolbars=no,scrollbars=no')

 XSL-List info and archive:

Current Thread