The problem is I want to be able to put <b> / <i> tags straight into the
text of the document and have them preserved when it is transformed into
HTML.
I've tried <xsl:copy> and <xsl:copy-of> but when the text is then put
through the <xsl:template> which preserves the line breaks the HTML tags are
stripped out.
Does anyone know how to preserve the HTML tags and preserve the line breaks?
all help appreciated,
Paul
--
http://www25.brinkster.com/dazzle
Make a donation to Open Source support and development:
http://www.25.brinkster.com/dazzle#donations
The Jesus Christ Cafe - an ebook not a religion -
http://www.nospine.net/default.asp?ShowTitle=0044-00194-001
Try this:
<xsl:value-of select="myHTMLTExt" disable-output-escaping="yes"/>
Orhan
"Paul" <dazz...@hotmail.com> wrote in message
news:#D2EbGIwBHA.1592@tkmsftngp07...
Don't do that. It's not portable.
It depends on your XSLT. You should start with an indentity transformation
(there's an example in the XSLT spec), then add the specific template for
your text formatting.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="ISO-8859-1"
omit-xml-declaration="yes" indent="yes" />
<xsl:template match="//info">
<h2>
<xsl:value-of select="title" />
</h2>
<br />
</xsl:template>
<xsl:template match="main">
<xsl:call-template name="cr">
<xsl:with-param name="word">
<xsl:value-of select="." />
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="cr">
<xsl:param name="word" />
<xsl:choose>
<xsl:when test="contains($word,'
')">
<xsl:value-of select="substring-before($word,'
')" />
<br />
<xsl:call-template name="cr">
<xsl:with-param name="word" select="substring-after($word,'
')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$word" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="//story" />
</xsl:template>
</xsl:stylesheet>
and here is the XML it transforms:
<?xml version="1.0"?>
<story>
<info>
<title>a title</title>
<author>the author</author>
<description>a description</description>
</info>
<main>
This is some text and this should be <i>italic</i> and this should be
<b>bold</b>
and this is a new line
and this is a paragraph
</main>
</story>
The line breaks are transformed into <br/> tags but in the transoformation
it strips out the HTML tags even when trying to use <xsl:copy> /
<xsl:copy-of>
All help appreciated
Paul
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:call-template name="cr">
<xsl:with-param name="word">
<xsl:value-of select="." />
</xsl:with-param>
</xsl:call-template>
</xsl:template>
and remove the "main" template.
"Paul" <dazz...@hotmail.com> schrieb im Newsbeitrag
news:#958ZXSwBHA.428@tkmsftngp04...
Thanks,
Paul
--
http://www25.brinkster.com/dazzle
Make a donation to Open Source support and development:
http://www.25.brinkster.com/dazzle#donations
The Jesus Christ Cafe - an ebook not a religion -
http://www.nospine.net/default.asp?ShowTitle=0044-00194-001
"Julian F. Reschke" <julian....@nospam-greenbytes.de> wrote in message
news:#cEv9bSwBHA.2516@tkmsftngp04...