[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: media-type setting in Java HttpServletResponse

Subject: RE: media-type setting in Java HttpServletResponse
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 6 Jan 2006 09:21:02 -0000
type setting
You can try using the getOutputProperties() method on the Templates object
to read the media-type property set in xsl:output. It's not very
satisfactory (for example it doesn't handle XSLT 2.0 things like named
output declarations) and my own instinct would be to maintain this
information somewhere else - it doesn't really belong in the stylesheet, in
my view, because it doesn't affect the result tree or even the serialized
output. But it might work for you.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Ai / Hiro [mailto:i@xxxxxx] 
> Sent: 06 January 2006 05:52
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  media-type setting in Java HttpServletResponse
> 
> Hi list,
> 
> I'm using java servlet and XSLT 2.0 with Saxon-B 8.6.1 and 
> want to output the result of a transformation with a proper 
> content type/media type, using the @media-type attribute of 
> an <xsl:output/> element or <xsl:result-document/> element 
> that has the attribute or the @format attribute that refers 
> to a named <xsl:output/> element. However, the specified 
> media-type is not recognized this way, so, I have to use 
> HttpServletResponse.setContentType(), which needs to be used 
> before the transformation. Other attributes of xsl:output, 
> such as @encoding, work well, but @media-type does not, at 
> least with the following codes:
> 
>    public void doGet(HttpServletRequest req, 
> HttpServletResponse res) throws IOException {
>      ...
>      //PrintWriter out = res.getWriter(); // does not work
>      OutputStream out = res.getOutputStream(); // neither
>      try {
>        trans.transform(xmlSource, new StreamResult(out));
>      }
>      ...
>    }
> 
> Does anyone have a clue how to make this work?
> 
> Regards,
> --
> Ai
> 
> http://orz.cc/ (ja-JP, en-US;q=0.9)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.