[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Formatting text to include html tags...?


Subject: Re: [xsl] Formatting text to include html tags...?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 5 Nov 2001 10:18:39 +0000

Hi Ragulf,

> Is there a way that I can do this? The solution should also enable
> newline (<br/>) tags, if possible.

It looks as though you want to use xsl:copy-of (which makes a deep
copy of whatever nodes you select, including elements) rather than
xsl:value-of (which gives the string value of a node, and doesn't
retain any structure). Try:

<xsl:template match="/">
        <html>
                <body>
                        <xsl:copy-of select="Test/node()" />
                </body>
        </html>
</xsl:template>

You need Test/node() rather than just Test because if you copied the
Test element, you'd get the Test element itself as well as its
descendants. With Test/node() you get a copy of the content of the
Test element without the Test element itself.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread