Hvid Hat wrote:
I'm using <xsl:copy-of select="content" /> on the following XML:
<?xml version="1.0"?>
<content>
<p></p>
<p>This is a paragraph</p>
<p></p>
<p>This is another paragraph</p>
</content>
The empty paragraphs, <p></p>, become <p/> when outputted to the browser.
How can I prevent this?
If you want to output HTML then make sure you use
<xsl:output method="html"/>
that should fix that.
I want to add an empty comment (or something else?)
so the paragraph tags aren't collapsed, eg. <p><!-- --></p>
I don't think you need the comment, xsl:output method="html" should suffice.
As for adding a comment you would need
<xsl:template match="p[not(node())]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:comment/>
</xsl:copy>
</xsl:template>
then you need to make sure you don't use xsl:copy-of select="content"
but instead apply-templates.
--
Martin Honnen
http://JavaScript.FAQTs.com/
|