Javascript in XSLT

Discussion in 'XML' started by Charles Chow, Dec 5, 2003.

  1. Charles Chow

    Charles Chow Guest

    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>
    ......
    Charles Chow, Dec 5, 2003
    #1
    1. Advertising

  2. Charles Chow

    Andy Dingley Guest

    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
    Andy Dingley, Dec 6, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    639
    Stylus Studio
    Aug 3, 2004
  2. Benjamin Hillsley
    Replies:
    3
    Views:
    1,661
    Dimitre Novatchev
    Sep 25, 2003
  3. ted
    Replies:
    1
    Views:
    613
    Laurens
    Jan 26, 2004
  4. Replies:
    2
    Views:
    708
    Henry S. Thompson
    Oct 19, 2005
  5. Replies:
    4
    Views:
    658
Loading...

Share This Page