RE: [xsl] Problems with JS inside XSL Files

Subject: RE: [xsl] Problems with JS inside XSL Files
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Mon, 28 Oct 2002 12:20:53 -0500
[Paulo]
> in my XSLT file I have this JavaScript code:
> 
> ...
> var div  = "<" + "div style=" + "position:absolute; 
> width:126px; height:122px; z-index:1" + ">" + "<" + "img 
> src=" + "imagens/seta_webmail.gif" + "width=" + "126" +  
> "height=" + "122" + ">" + "</img></div>"; document.write(div); ...
> 
> and I´m receiving this error message:
> 
> msxml4.dll error '80004005'
> 
> Error while parsing "file:///D:/WEB/dorio.xml/webmail.xsl". 
> Illegal qualified name character.
> 

You have not quoted the value of your attributes, and that will give you an error - perhaps that is what the error message is trying to tell you, although it is really a not-wellformed error.  You need code like this:

var div = "<div style='position:absolute;width:126px;...'>"
div += "<img src='imagens/seta_webmail.gif' width='126' ...></img></div>"

You could use the javascript continuation character to make the same thing more readable, like this -

var div = "<div style='position:absolute;width:126px;...'>\
<img src='imagens/seta_webmail.gif' width='126' ...>\
</img></div>"

If you want to include newlines so you can read the result of document.write() more easily, just insert them:

var div = "<div style='position:absolute;width:126px;...'>\n\
<img src='imagens/seta_webmail.gif' width='126' ...>\n\
</img></div>"

Cheers,

Tom P

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread