Re: [xsl] set header in XSLT

Subject: Re: [xsl] set header in XSLT
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Fri, 19 Apr 2002 01:33:13 +0200
Ming wrote:
I'm using java servlet to display a xml file using XSLT. I need to set the
media type to a specific one. So, I use setContentType in my Java Servlet
and use <xsl:output method="text"
media-type="application/x-research-info-systems"/>.

(I'm not very sure if I should use method="text". But I don't know what to
use)
There are three output methods: xml (default), html, text.
If you are producing HTML, use html, if you are producing
XML, use XML. Use text otherwise.
I'm sure you know what you are producing?

BTW setting a media type in a style sheet which is processed
by an processor you've embedded yourself does not have any
effect in itself, see below.


But I still need to set a header, provider=LAN which a required header
element. I can use the setHeader in my java servlet. But I don't know how
to do this in XSLT.

You can only set headers using setHeader() in your servlet. There is no way to do it from the style sheet. The output of an XSL transformation does not know anything about HTTP headers. You can query some settings from the transformer object you use for a particular transformation, and use this information to set headers. This wont happen automatically, you have to program this.

J.Pietschmann


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread