Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Javascript in XSLT

Reply
Thread Tools

Javascript in XSLT

 
 
Charles Chow
Guest
Posts: n/a
 
      12-05-2003
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
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-comslt"
xmlns:user='urn:user'
version="1.0">
<xslutput 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>
......
 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      12-06-2003
On 5 Dec 2003 14:44:42 -0800, (Charles Chow)
wrote:

>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.
--
Die Gotterspammerung - Junkmail of the Gods
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Including XSLT/XML document within a XSLT document dar_imiro@hotmail.com XML 4 12-13-2005 02:26 AM
Multiple XSLT Transforms using a Controller XSLT sneill@mxlogic.com XML 2 10-19-2005 11:00 AM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM
xslt alone or xslt/java for static site? ted XML 1 01-26-2004 10:41 AM
[XSLT]Passing values from Javascript to a XSLT variable Benjamin Hillsley XML 3 09-25-2003 04:50 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57