xsl-list
[Top] [All Lists]

Re: Should XSLT be used to generate a plain text document?

2005-04-27 08:50:11
Chris,

At 05:30 AM 4/27/2005, Jirka wrote:
I would like to know if it is possible to use XSLT to create a
document, like the above example, from an XML file.
I'm still new to XSL/T so i'm not really sure of its limitations, or
even if this is something i should be attempting with with it.
When i think about it transforming to plain text doesn't sound right,
but some expert opinions would be good :)

XSLT doesn't have any built-in support for wrapping paragraphs and layouting tables. You can do this sort of task in XSLT, but it is a lot of work.

I would suggest you little bit different approach. Write stylesheet that will produce HTML output from your XML files. Then use some text-based web browser (lynx, links, ...) to render this HTML into plain text. This way HTML browser will take care of laying out text -- which is the hardest part of your problem.

I endorse this approach if you can find a renderer that will make the plain text you want. Essentially it's the solution Mike suggested, except HTML is used as the intermediate format and an off-the-shelf tool is used to provide the plain text formatting in step 2.

In a pinch, for a one-off, you can even use a browser's "Save As" for this. :->

What makes this tricky is that by "plain text" people often mean not text that's very plain, but ASCII-art-like text that is plain only in the sense that it's free of any markup or encoding whatsoever (apart from the text itself) ... as always it depends on the requirements.

Cheers,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>