XSLT: HTML parsing in XML?

On my website, I have XML files with the contents of my page (automatically generated from my database) that are displayed using XSLT. The problem is this: I would like to have some formatting in some XML tags. For example, if I have XML containing an article in the format:

<article>
  <header>Cool article</header>
  <author>Me!</author>
  <content>
    This is an article. It <b>HUGE</b>, and here a <a href="http://Www.foo.com">link</a>.
  </content>
</article>

However, if I just get the content using this: <xsl:value-of select="content" />all HTML formatting is ignored / lost. I assume that this is mistaken for XML child nodes, not the actual data found in the content node.

What is the preferred way to achieve formatting as described here?

Thanks in advance.

+5
source share
6 answers

, :

 <xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
          media-type="application/html+xml" encoding="utf-8" omit-xml-declaration="yes" indent="no"/>

, html,

application/html
+2
<xsl:value-of select="content" /> 

a node. <content> node :

This is an article. It HUGE, and here a link

, node:

<xsl:copy-of select="content" /> 

, , .

+7
<xsl:value-of
select="..."
disable-output-escaping="yes"/>

, Firefox.

+3

html, , CDATA . , , (, JS), .

0

XML , <![CDATA[ ]]>, .

0

HTML XML , HTML- , XML. .

This is an article. It <b>HUGE</b>, and here a <a href="http://Www.foo.com">link</a>.  

:

This is an article. It &lt;b&gt;HUGE&lt;/b&gt;, and here a &lt;a href="http://www.foo.com"&gt;link&lt;/a&gt;

CDATA, HTML .

0

All Articles