The task seems to be pretty easy: how to include a Javascript file in xml-document so that at least Opera and Firefox could actually parse it and execute the code?
A function that should help you is the eval() function. This function will evaluate any string you pass to it as Javascript.
Also, it's possible to parse XML in Javascript. Just google "javascript xml parser".
Combine these two ideas, and you'll be on your way.
If you simply want to put javascript in the XML file:
<xml> <js script="1"> here is some javascript; here is more javascript; </js> <js script="2"> here is even more javascript; jere is even more javascript; </js> </xml>
If I get you, you want an XML document to run javascript when viewed in a browser?
This is not part of the XML standard, and as such will not be suppoted until it is (I assume this will never be supported because XML is not intended for display, but data). If you are talking about XHTML then this is a different matter.
--
Edit: just to clarify my answer.
XML was never intended to be a display markup like HTML, thats why XHTML was developed (HTML that conforms to XML standards). Browsers have been made to interpret XHTML in a certain way, but XML is simply raw data.
If you want your XML to run additions such as JavaScript you will want to consider using XSLT to transform your XML into XHTML and therefore take advantage of a browsers capabilities.
Embed the XML and the Javascript in an XHTML document and then use the vast and well-documented capabilities of dynamic HTML.
You'll get something up and running much faster than you will by reasoning that since some browsers implement weak and poorly-documented CSS styling of XML documents, therefore they must support the execution of Javascript embedded in XML, as though there were any connection whatsoever between those two ideas.
Just add a script stating XHTML namespace, it will run just fine.
<xhtml:script xmlns:xhtml="http://www.w3.org/1999/xhtml"
src="file.js"
type="application/javascript"/>
See also http://www.ibm.com/developerworks/xml/library/x-ffox3/