hi Steve, This is the same mail that i sent to your mail box directly.. i am extremely sorry for that.These mail is to the cocoon users group to rectify that mistake of mine.
and wrt ur mail ,these is what i found: I tried accesing the MoveCircle.js file from the client machine using these (url = http://localhost/cocoon/SvgApps/scripts/MoveCircle.js) and it works fine from there.So i think that sitemap seems to pick it up fine. I tried removing the mime-type for .JS files and still got the same error Message Box which says "Microsoft JScript runtime error:Object expected line:1,column:0" I am not using the .js file from inside the html page which gets generated but from inside the .svg file...bcos the in the future, i would like the dynamically generated svg to just work as the main svg container which internally is built up of other svg image layers using the svg:image tag so that the final svg image created have there own user event handling based on what layer is currently active. Since you said you have been using .JS from the html container page,have you been able to get hold of the handle to the svg doc element ? regards Gautam >>> "Steve Schwarz" <[EMAIL PROTECTED]> 02/10/04 02:36PM >>> I'm serving JS files without setting the mime-type and it just works. Are you sure the file is being served to your client? See if you get it when you request that file directly you get it. Compare the path in the HTML file that loads the JS file too. HTH, Steve >From: "Gautam Ganguly" <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: <[EMAIL PROTECTED]> >Subject: Embedded JavaScript file inside dynamic SVG isn't working >Date: Tue, 10 Feb 2004 13:05:00 -0600 > >hi all, > I am trying to make these dynamic svg which i create using xsp to >also use the javascript file but it somehow doesn't seem to find it. > The basic system setup is: > JDK-1.4.1 > Win2k Professional > Cocoon-2.1.2 > Tomcat-4.1.27 > >These is what my sitemap looks like: ><map:match pattern="ShowMeSVG.html"> > <map:generate type="serverpages" src="docs/svg/result.xsp"/> > <map:transform src="docs/svg/style/GenDynaSvg.xsl"/> > <map:transform type="extractor"/> > <map:transform src="docs/svg/style/fragment-extractor.xsl"/> > <map:serialize/> ></map:match> > ><map:match pattern="svgimages/*.svg"> ><map:generate type="extractor" src="{1}"/> ><map:serialize/> ></map:match> > ><map:match pattern="scripts/MoveCircle.js"> ><map:read src="resources/js/MoveCircle.js" > mime-type="text/javascript"/> ></map:match> > ><map:match pattern="resources/**.js"> > <map:read src="resources/js/{1}.js" > mime-type="application/x-javascript"/> ></map:match> > >--------------------------------- >And the files looks like these: > >[Result.xsp] >------------------------- ><?xml version="1.0" encoding="ISO-8859-1"?> ><xsp:page language="java" xmlns:xsp="http://apache.org/xsp"> > <document> > <graph> > <row>NO DATA</xsp:expr></row> > </graph> > </document> ></xsp:page> > >[fragment-extractor.xsl] >------------------------------- ><?xml version="1.0"?> ><xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:fe="http://apache.org/cocoon/fragmentextractor/2.0"> > > <xsl:template match="//fe:fragment"> > <embed width="400" height="200" unit="pixels" border="2" >src="svgimages/[EMAIL PROTECTED]" name="svgmap" >type="image/svg+xml" > > pluginspage="http::/www.adobe.com/svg/viewer/install/"/> > </xsl:template> > <xsl:template match="@*|*|text()|processing-instruction()" >priority="-1"> > <xsl:copy> > <xsl:apply-templates >select="@*|*|text()|processing-instruction()"/> > </xsl:copy> > </xsl:template> ></xsl:stylesheet> > > > >[GenDynsSvg.xsl] >----------------------------------------------- ><?xml version="1.0"?> ><xsl:stylesheet version="1.0" >xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >xmlns:svg="http://www.w3.org/2000/svg" >xmlns:xlink="http://www.w3.org/1999/xlink"> ><xsl:import href="GenDynHtmlTemplate.xsl"/> > <xsl:template match="graph"> > <svg:svg xml:space="preserve" > width="400" height="200" onload="init(evt)" >xmlns="http://www.w3.org/2000/svg" >xmlns:xlink="http://www.w3.org/1999/xlink"> > <svg:script xlink:href="scripts/MoveCircle.js" >type="text/javascript"/> <svg:circle id="Circle1" cx="80" cy="40" >r="30" > style="stroke-width:2;stroke:black;fill:white; >fill-opacity:0.5" > onmouseup="mouseup(evt)" onmousemove="move(evt)" >onmousedown="click(evt)"/> > </svg:svg> > </xsl:template> ></xsl:stylesheet> > >[GenDynHtmlTemplate.xsl] >-------------------------------------------------------------- ><?xml version="1.0"?> ><xsl:stylesheet version="1.0" >xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> ><xsl:template match="/"> > <html> > <head> > <title>Embedding SVG Image using Javascript</title> > </head> > <body> > <table border="0" cellspacing="0" cellpadding="0"> > <tr> > <td valign="top" align="right"><xsl:apply-templates/></td> > </tr> > </table> > </body> > </html> ></xsl:template> ></xsl:stylesheet> > >MoveCircle.js >------------------------------------------------------------- > var track=false; > var SVGDoc; > function init(evt) { > // Get the Document > SVGDoc = evt.getTarget().getOwnerDocument(); > // Get the circle you'll be dragging around > nodeCircle = SVGDoc.getElementById("Circle1"); > } > function click(evt){ > track=true; > } > function mouseup(evt){ > track=false; > } > function move(evt){ > // get window values > var x = evt.getClientX(); > var y = evt.getClientY(); > if (track==true) > { > // set the center point of the circle to the new values > nodeCircle.setAttributeNS(null,"cx",x); > nodeCircle.setAttributeNS(null,"cy",y); > } > } > >------------------------------------------------- >Main Task is just not to show the SVG images dynamically but also to >let the user edit them on the web-page. > The dynamic generation of the svg image and embedding them into the >HTML page and displaying it works just great...thanks to you all out >there >who helped me!! > The next task of make the displayed SVG image using the Javascript >file >is where i am getting struck at:(. > I have tried to put the javascript file in every available location >that i could think of,but still cocoon doesn't seem to find it..and as a >matter of fact even tried to force the pipeline to use only the one >javascript file as you can see in the sitemap..but that too didnot >help. > I even placed the java script code into the svg file by using the ><script type="text/ecmascript"><![CDATA[ ]]></script> tags didn't help >it either. > Any clues ..any suggesttion would be of lot of help. > Thanks to you all ..again. > >regards >Gautam > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > _________________________________________________________________ Plan your next US getaway to one of the super destinations here. http://special.msn.com/local/hotdestinations.armx --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
