What Joern said is correct. I'll elaborate some more, though. Since you've set <map:serialize type="xml"/>, you're sending XML to the browser (mime type: text/xml).
Most browsers don't know how to natively display XML, so it looks wacky. IE, however, does know how to do it, so it does - as you've seen. However it re-formats it (doesn't display it as straight text; display tree expansion + and - symbols, etc.) So how to accomplish what you want? A couple of possibilities: * "Trick" cocoon into sending XML data as text: * The default XML serializer looks like this: <map:serializer name="xml" mime-type="text/xml" src="org.apache.cocoon.serialization.XMLSerializer">. * I think that if you change the mime type you can still generate XML, but make your browser think it's text: <map:serializer name="xmlastext" mime-type="text/plain" src="org.apache.cocoon.serialization.XMLSerializer">. * Then use this serializer instead of the standard XML serializer: <map:serialize type="xmlastext"/> * Generate XML as usual, but trigger a download: * In my Cocoon app, I have a need to trigger a file download. You can do that using: response.addHeader("Content-Disposition", "attachment; filename=" + QUOTE + filename + QUOTE); * Then the user will be prompted to download the XML file, after which they can open it either using the default .xml file handler or using any other app they want. Hope this helps. DR At 05:07 PM 12/10/01 +0100, you wrote: >The browser shows the xml file becuase of its content type text/xml. >If you change that (you can do so in the sitemap) to application/x-whatever >your browser should ask you to save or view it. But that's not Cocoon >specific. > >If you want to show the source code I think you have to write a xslt which >produces < und >. > >Copy and Paste is not a task of a browser or Cocoon. There's no way to do >this except the user. > >I can't understand your problem with FOP. What do you mean with XML2XML? FOP >means xml->pdf (via xsl:fo). The question is if you want to have a pdf. If >so, you can look for other approaches like xml->tex->ps->pdf (there were >some topics about that before I think). > >JOERN > >-----Ursprüngliche Nachricht----- >Von: Matthias Fischer [mailto:[EMAIL PROTECTED]] >Gesendet: Montag, 10. Dezember 2001 16:52 >An: [EMAIL PROTECTED] >Betreff: RE: XSLT transformations with Cocoon (added clearer >formulation) > > >That was real quick, David. Thanks. > >I'll clarify: > >1. In Tomcat [4] we have set the destination type to <map:serialize >type="xml"/>, as you have suggested. >The following problems have arisen: >- Internet Explorer gets into Cocoon's way and wants to open the xml file >when I click onto it to start the transformation. We haven't found a way to >stop IE doing that. >- Alternatively, we have set Tomcat to <map:serialize type="html"/>, >producing an html output with the option of (a) viewing the source code, (b) >copy it to the clipboard, (c) paste it into an empty xml file using some XML >editor, (d) saving the xml file in the xml editor. This (a)..(d) does not >seem satisfactory at all. > >We need the xml output as an xml file, to further process it. > >Therefore, we'd prefer to >- set the destination type to <map:serialize type="xml"/> >- click on the xml file or any other destination file from inside the >browser TO START THE TRANSFORMATION >- have our xml editor open the xml file produced by the transformation or, >alternatively, view the xml sourcecode directly in the browser or, >alternatively, have an xml file dropped unviewed somewhere in a specified >destination folder. > >Is this possible, and if it is, how? > >2. The other question I tried to get over before was this: When we embarked >in FOP transformation we didn't expect so many problems linked to the >processor. However, we got lots of problems with non-existing or even wrong >documentation, non-working functions or functions working under some very >specific conditions. Is the state of realization of XML2XML with Cocoon [2] >satisfactory under this aspect? Or would anybody advise me to use rather a >different processor? > >Thanks for your answer(s) in advance, > >Matthias > > >-----Original Message----- >From: David Rosenstrauch [mailto:[EMAIL PROTECTED]] >Sent: Monday, December 10, 2001 4:00 PM >To: [EMAIL PROTECTED] >Subject: Re: XSLT transformations with Cocoon > > >I'm not sure I understand your question, so I'll try to answer as best I >can: > >* Is it possible to use cocoon to do an XSLT transformation with the output >being XML? >Yes. <map:serialize type="xml"/> > >[...] > >DR --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>