How to tell what extension the xml file shall have

I pass the xml true the passtrue server so that it shall come out in many different format like rtf asci html and so on how do I tell what extension it shal have when the user downloaded them becusse now they are all called my database name and have no extension?

Hello DBB,

WebDAV Urls can contain a file extension.
Are you using the pass through servlet before or after the WebDAV servlet?

Best regards

Juergen

I am not using the webdaw server I am only sending a request to the tamino database and getting a xml file back that have been send true the passtrue server to become a doc or html or txt file

In principle, the “file extension” doesn’t matter. What matters is the media type (also called MIME type or content type) of the returned document, as set in the HTTP headers. The passthru servlet takes this from the contenttype parameter which is among the initialization parameters for the servlet - look for an entry like this in the web.xml file:


contenttype
text/html


In principle you should be able to set the media type from within the stylesheet, for example <xsl:output method=“text” media-type=“text/plain”/>. But I found during testing that it wasn’t possible for the servlet to obtain this information reliably using the JAXP interface, so the media-type used in xsl:output is ignored.

This gives you a bit of a problem if you use the same servlet with different stylesheets to produce different output types. I think it should be possible to set up multiple instances of the servlet in the configuration file, with different parameters, but this isn’t something I have tried.

Some browsers, notably Internet Explorer, have something of a reputation for ignoring the content type in the HTTP header and trying to guess it from the “file extension” instead. For example, I have seen IE, when retrieving the URL:

http://example.com/servlet/transform?style=my.xsl&source=my.xml

assume that the “.xml” meant that the result would be XML, even though the HTTP headers said that the response was text/html. I sincerely hope this problem has been fixed in current IE versions, but you can’t be sure. To protect yourself against this browser bug, you can add a dummy argument to the URL, for example:

http://example.com/servlet/transform?style=my.xsl&source=my.xml&dummy=plain.txt

I hope this helps you. If you have further questions on the PassThru servlet, it’s best to raise them in the PassThru forum, which is where I and other users will be looking and are more likely to be able to help you.

Michael Kay

I will tray the thing you point out and report back if it works, and yes I will use the right forum from now on hehe :wink:
Thanks for all help tho.

I must agree whit you that the best form to do this, so all browser get it, is offcurse
the dummy one.

http://example.com/servlet/transform?style=my.xsl&source=my.xml&dummy=plain.txt