tags:

views:

59

answers:

1

Lately I have become a huge fan of XSL, XPath and XML, but I've only used it to format outputted html documents, with a head and body sections.

I was wondering if its possible to use good of XSLT to format other types of documents, like plain txt?

+5  A: 

Yes of course - just use

<xsl:output method="text" indent="yes"/>

instead of

<xsl:output method="html" indent="yes"/>

Marc

UPDATE: whitespace and formatting text exactly as needed are always a bit tricky in XSLT. Check out some of those references:

marc_s
Thanks Marc, will line breaks occur naturally, same as in the template?
JL
If you use direct element constructors, whitespace within will be collapsed by the usual rules. `<xsl:text>` is space-preserving, and lets you control output at character precision, however.
Pavel Minaev