Hi Cameron,
My comments are inline...
Cameron Moore wrote:
> Hello all,
> I'm new to XSLT and have some questions I hope you folks can answer. I
> have an XML file that is geared toward human-readability that I want
> transformed into a text file. Here's an example of how the XML looks (I
> stole the <intro> section from the Sablotron docs):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <faq>
> <faqinfo>
> <title>My FAQ</title>
> </faqinfo>
> <intro>
> XSLT is a language allowing to transform given XML data (the input)
> according to a stylesheet. XSLT stylesheets are themselves XML
> documents; that is, all instructions of the language are expressed
> in the form of XML elements. The output, i.e. the result of the
> processing, is typically a XML document as well, although the
> syntactic requirements can be relaxed to allow the creation of a
> HTML document (one that contains unclosed tags and the like), or
> even plain text.
> </intro>
> </faq>
>
> I want the text output to look something like this:
>
> <output>
> My FAQ
>
> -------------------------------------------------------------------
>
> INTRODUCTION
>
> XSLT is a language allowing to transform given XML data (the
> input) according to a stylesheet. XSLT stylesheets are
> themselves XML ...
>
> -------------------------------------------------------------------
> ...
> </output>
>
> The problems are that [1] I have all endl's, tabs, and spaces in the
> output that are in the original XML file, and [2] I don't know how
> to make the paragraphs wrap.
>
> I think xsl:strip-space may solve part of my problem, but I'm not sure.
> Is this what xsl:strip-space is for?
Yes, but xsl:strip is not supported yet. You can try to use
normalize-space() function:
<xsl:value-of select="normalize-space(...)"/>
> How do I solve the paragraph formatting problem? Am I getting into
> XSL-FO or can XSLT handle this?
Paragraphs wraping is a bit tricky as this is not what XSLT is intended for.
However, a workaround certainly could be found.
My understanding of the use of XSLT or XSL-FO is the following: XSLT is
usually sufficient to generate data to be displayed in electronical form
(HTML, simple plain text). If you need to print out well defined documents,
you likely have to use XSLT-FO.
> One other thing while I'm here: I haven't seen anyone else request
> this, so let me say I could definately use xsl:number support. *grin*
Works are in progress.
> Well, thanks for your time. And a special kudos to the developers.
> Sablotron is very nice. Thank God there's an XSLT processor that's
> *not* written in Java!
> --
> Cameron Moore
Regards,
Petr
--
Petr Cimprich
Ginger Alliance
www.gingerall.com