cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anna Afonchenko" <a...@ubaccess.com>
Subject Problem in ScriptGenerator for .js file
Date Tue, 26 Nov 2002 11:04:14 GMT
Hi All. It's me again :-)
Thank you all for answering my previous questions. You are great!
So I have another question (this one is probably stupid):
I want to execute some Javascript file (some.js) through Cocoon pipeline
the code of this some.js file is:
<!--
 document.write('Hello World!');
//-->

if I embed this file into some html (<script src="some.js"/>), it executes correctly.
But if I am including it to the pipeline, e.g.:
<map:match pattern="*.js">
    <map:generate src="{1}.js" type="script"/>
    <map:transform src="some.xsl"/>
    <map:serialize/>
</map:match>

I get an error from cocoon:
org.apache.cocoon.ProcessingException: Exception in ScriptGenerator.generate(): com.ibm.bsf.BSFException:
JavaScript Error: Internal Error: ReferenceError: "document" is not defined. (file:/C:/Program
Files/Apache Group/Tomcat 4.1/webapps/cocoon-dev/xsp-js/try.js; line 1)

Why is this happening?
I can't change the document.write to something else, because I don't write the some.js, I
get it from the external HTML page.
Please tell me if I can use the ScriptGenerator on such Javascript file (and not only on .js
files
like in the cocoon example: cocoon/scripts.hello.js).

Thank you for your help.

Anna

Mime
View raw message