why does a formatted text not preserve the <p> tag
This is an open discussion with 5 replies, filed under XSLT.
Search
value-of
is supposed to strip all elements before returning the value. To preserve them you have to use copy-of
:
<h1><xsl:copy-of select="/data/test/entry/tekst1/*"/></h1>
Thanks. Learned another thing.
Another tip: don't put <P/>
aragraph elements inside <H1/>
elements :P
Davidhund : also thanks for this tip.
You can also use this:
<xsl:apply-templates select="tekst1/* | tekst1/text()" mode="html"/>
(you need to include the typography.xsl utility that ships with Symphony). This would output recursively any node and text value of your xml fragment, and you can also override certain elements you need to straighten.
Create an account or sign in to comment.
If I have this piece of xml :
And I use this xslt :
Then the output is this :
So the
has disappear. Is this normal behaviour and if so, how can I preserve the
<p>
and<br>
tags ?