javascript in XSLT

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles Chow

    javascript in XSLT

    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.c losed ) {
    -------------------------------------------^


    XSLT files:
    -------------
    <?xml version="1.0"?>
    <xsl:styleshe et
    xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="ur n:schemas-microsoft-com:xslt"
    xmlns:user='urn :user'
    version="1.0">
    <xsl:output 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="javas cript">
    var playerwindow=nu ll;
    function LaunchPlayer(na me,iname,number ,date,duration)
    {
    var location;
    var qlocation;
    var winname;
    location = document.URL;
    location = location.substr ing(7,location. length);
    var pos = location.lastIn dexOf("\\");
    location = location.substr ing(0,pos);
    location = location.replac e(/\\/g,"\\");
    location = location + "\\";
    qlocation = unescape(locati on);
    winname = 'Player.html?Pa ram=' + qlocation + ',' + name;
    winname = winname + ',' + number + ',' + date + ',' + iname +
    ',' + duration;

    if ( playerwindow && !playerwindow.c losed ) {
    if ( confirm("Are you sure you want to play another
    recording?") ) {
    playerwindow.do cument.MediaPla yer.stop();
    playerwindow.cl ose();
    playerwindow =
    window.open(win name,"Player"," height=200,widt h=440,status=no ,toolbar=no,men ubar=no,locatio n=no;
    titlebar=no");
    playerwindow.fo cus();
    }
    }
    else {
    playerwindow = window.open(win name,"Player"," height=200,widt h=440,status=no ,toolbar=no,men ubar=no,locatio n=no;
    titlebar=no");
    playerwindow.fo cus();
    }
    return;
    }
    </SCRIPT>
    </HEAD>
    ......
  • Eric Bohlman

    #2
    Re: javascript in XSLT

    charles.chow@t-netix.com (Charles Chow) wrote in
    news:191830fd.0 312051436.5e83d d73@posting.goo gle.com:
    [color=blue]
    > 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.[/color]
    [color=blue]
    > 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.c losed ) {
    > -------------------------------------------^[/color]

    In XML documents (such as XSLT files), "&" has a special meaning and needs
    to be escaped (by writing it as &amp; or, probably better when including
    scripts, enclosing the whole script in a CDATA section).

    Comment

    Working...