Re: Serving plain text

Posted by Erik Bruchez on
URL: https://discuss.orbeon.com/Serving-plain-text-tp26088p26104.html

Colin O'Brien wrote:

> The combination of text converter and http serializer did produce just
> the text I wanted.
> I took the <docuemnt> element from the output of the text converter and
> made it the wrapper element in my xslt and removed the text converter
> and I still got what I wanted.

Yes, you can do that.

> So the docs are probably right in as much as what they say, but they
> don't spell out that the serializers will strip wrapper elements when
> they conform to the OPS non-xml document spec.

It kind of goes without saying, since there is no such thing as an
"element" in a plain text document ;-)

> One thing that seems to be missing in the converter/serializer combo
> compared to the legacy text serializer is the ability to suggest a name
> for the file being downloaded.
> It doesn't matter for what I am doing, since the file isn't intended to
> be downloaded to the client file system, but I could see it being more
> important with examples like csv.

You can, as shown in the existing epilogues for PDF handling:

<p:processor name="oxf:xslfo-converter">
     <p:input name="config"><config/></p:input>
     <p:input name="data" href="#xformed-data"/>
     <p:output name="data" id="converted"/>
</p:processor>
<p:processor name="oxf:http-serializer">
     <p:input name="config">
         <config>
             <header>
                 <name>Cache-Control</name>
                 <value>post-check=0, pre-check=0</value>
             </header>
             <!-- This is what causes a file name to be suggested -->
             <header>
                 <name>Content-Disposition</name>
                 <value>attachment; filename=document.pdf</value>
             </header>
         </config>
     </p:input>
     <p:input name="data" href="#converted"/>
</p:processor>

> Thanks once again for your help and the ever greater OPS system

You are welcome :-)

-Erik




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws