Javascript in XSLT

C

Charles Chow

Any clue on why I got this error when I use javascript function in
XSLT? The same javescript works fine with ASP. What this function
does is to keep only one window (with media player activeX control)
instance.

Your assistance is much appreciated.

Charles

Error message:
----------------
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error
and then click the Refresh button, or try again later.

A name was started with an invalid character. Error processing
resource 'file:///C:/temp/case_export/tt-200312031606/MyCase.xslt'.
Line 39, Position 44

if ( playerwindow && !playerwindow.closed ) {
-------------------------------------------^


XSLT files:
-------------
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user='urn:user'
version="1.0">
<xsl:eek:utput method="html"/>
<xsl:template match="RMSCase">
<HTML>
<HEAD>
<TITLE>My case</TITLE>
<STYLE>
.data {font-family:tahoma, sans-serif; font-size=10pt}
.title {font-family:tahoma, sans-serif; background-color:eeeeee;
font-size:8pt; padding:5,5,5,5}
.text {font-family:courier new; font-size:10pt}
.header {font-family:verdana; font-size=14pt}
.header2 {font-family:verdana; font-size=12pt;}
.header3 {font-family:verdana; font-size=10pt;}
</STYLE>
<SCRIPT language="javascript">
var playerwindow=null;
function LaunchPlayer(name,iname,number,date,duration)
{
var location;
var qlocation;
var winname;
location = document.URL;
location = location.substring(7,location.length);
var pos = location.lastIndexOf("\\");
location = location.substring(0,pos);
location = location.replace(/\\/g,"\\");
location = location + "\\";
qlocation = unescape(location);
winname = 'Player.html?Param=' + qlocation + ',' + name;
winname = winname + ',' + number + ',' + date + ',' + iname +
',' + duration;

if ( playerwindow && !playerwindow.closed ) {
if ( confirm("Are you sure you want to play another
recording?") ) {
playerwindow.document.MediaPlayer.stop();
playerwindow.close();
playerwindow =
window.open(winname,"Player","height=200,width=440,status=no,toolbar=no,menubar=no,location=no;
titlebar=no");
playerwindow.focus();
}
}
else {
playerwindow = window.open(winname,"Player","height=200,width=440,status=no,toolbar=no,menubar=no,location=no;
titlebar=no");
playerwindow.focus();
}
return;
}
</SCRIPT>
</HEAD>
......
 
A

Andy Dingley

Any clue on why I got this error when I use javascript function in
XSLT?
A name was started with an invalid character. Error processing
resource 'file:///C:/temp/case_export/tt-200312031606/MyCase.xslt'.
Line 39, Position 44

if ( playerwindow && !playerwindow.closed ) {
-------------------------------------------^


Common problem. You're using "&" to mean something in JavaScript,
when it's already a "special" character in XML. You can get similar
trouble with "<"

Do some searching (probably in this NG) and look for JavaScript and
CDATA sections.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top