File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Xalan for SVG Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Xalan for SVG" Watch "Xalan for SVG" New topic

Xalan for SVG

Sudarsan Raman

Joined: Aug 20, 2003
Posts: 12
I'm trying to use xalan for SVG, things seems to go thru properly,
I get the SVG output but this SVG output comes as file download.
i.e. It comes with Open or Save buttons.
My xsl utput is something like this.
<xsl utput method="xml" omit-xml-declaration="no" media-type="image/svg+xml"/>
or (tried with both)
<xsl utput method="html" omit-xml-declaration="no" media-type="image/svg+xml"/>

Is that fine or I need to do add any other attributes ??
Is the problem described above because of the xsl utput??
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
You have to tell the content type in the HTTP response as well in order to get the browser to recognize the content as SVG. How are you serving the SVG? If it's through a servlet performing the XSL transformation, you need to say HttpServletResponse.setContentType("image/svg+xml"). If you're doing the transformation offline and serving a static SVG file, you need to tell your web/app server that the MIME type for *.svg files is "image/svg+xml".

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I agree. Here's the link:
subject: Xalan for SVG
It's not a secret anymore!