开发者

Using escaped HTML tags in XML documents as HTML code after XSLT transformation

I have xml files with escaped HTML code in them, and I want to use this as real html tags in the html output after an XSLT transformation. Some example XML may look like this:

<root_node>
  <html_node>
    First line&lt;br&gt;
    Second line
  </html_node>
</root_node>

And a开发者_JS百科n XSLT stylesheet could look like this:

<xsl:stylesheet>

  <xsl:output method="html"/>

  <xsl:template match="root_node">
    <html>
      <body>
        <xsl:value-of select="html_node"/>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="*"/>

</xsl:stylesheet>

I want the &lt;br&gt; to actually produce a <br> tag in the resulting html code. How can I achieve this? I prefer using the standard Java API:s.


You are looking for the disable-output-escaping attribute to xsl:value-of

<xsl:value-of select="expression" disable-output-escaping="yes|no" />

http://www.w3schools.com/xsl/el_value-of.asp

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜