Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Xalan for SVG

 
Sudarsan Raman
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic