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

Onmouseover and onmouseout in xsl

Subject: Onmouseover and onmouseout in xsl
From: "Emsley, I (Iain)" <I.Emsley@xxxxxxxx>
Date: Mon, 14 Apr 2008 09:49:17 +0100
 Onmouseover and onmouseout in xsl
Morning,

I am currently trying to embed an onmouseover event in my first XSL
sheet but am having difficulties in getting the event to work.

Have I set the JavaScript up correctly in XSL? Also, is there a best
practice on embedding JS in XSLT - for instance is it best to link to an
external file (the same with CSS) and if so, what is the best way of
doing this?

Many thanks in advance for any help,

Iain

The code that I have so far is:
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">

<html>
<head>
<style><xsl:comment>
h2 {
text-align: center;
font-family: Verdana;
}
td {
  font-family: Arial;
  text-align: left;
}

</xsl:comment>
</style>
<script type="text/javascript">
<![CDATA[

var newWindow;

function newWindow {
	if(!newWindow || newWindow.closed) {
	newWindow = window.open("test.html","sub", "status,height=200,
width=300");
	//delay writing whilst Windows catches up
	setTimeout("writetoWindow()", 50);
} else if (newWindow.focus) {
	//new Window is already open so bring to front
	newWindow.focus();
	}
}//end newWindow
function writetoWindow() {
	var newContent = "<html><body><p>Hello World!</p></body</html>";
	newWindow.document.write(newContent);
	newWindow.document.close();
}
function close() {
	newWindow.close();

}

]]>
</script>
<title>Charles Dickens</title>
</head>
<body>
<table name="Charles Dickens">
<tr>
<td colspan="3">
<h2>Charles Dickens</h2>
</td>
</tr>
<xsl:for-each select="dickens/text">
<tr>
<td>
<xsl:attribute name="onmouseover">newWindow()</xsl:attribute>
<xsl:attribute name="onmouseout">close()</xsl:attribute>
Diffs
</td>
<td><strong><xsl:value-of select="lineno"/></strong></td>
<td><xsl:value-of select="line"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

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.