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

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
javascript gotourl
The best way (or just an alternative) to handle window.open'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 window.open directly.

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

function gotoURL (thePage){
    window.open(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:
<a
href="javascript:gotoURL('default.html');loadVars();someOtherFunction();">Ho
me</a>

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
select="$theURLtoGoto"/>');"&gt;
<xsl:value-of select="$linkText"/>
&lt;/a&gt;
(probably should be all one line...I separated to make it a little more
clear...)

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
is
> > opened in a new window with specific parameters.  I know how to do this
in
> > Javascript using the code
> >
> > onClick="window.open('default.html','new','toolbars=no,scrollbars=no')



 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.