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=""/>), it executes correctly.
But if I am including it to the
pipeline, e.g.:
<map:match pattern="*.js">
<map:generate
src="" type="script"/>
<map:transform
src=""/>
<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
|