Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I preserve markup tags?

Tags:

xml

xslt

I've got an XML document containing news stories, and the body element of a news story contains p tags amongst the plain text. When I use XSL to retrieve the body, e.g.

<xsl:value-of select="body" />

the p tags seem to get stripped out. I'm using Visual Studio 2005's implementation of XSL.

Does anyone have any ideas how to avoid this? Thanks.

like image 635
gilles27 Avatar asked Oct 02 '08 13:10

gilles27


1 Answers

Try to use

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

instead. From w3schools' documentation on same:

The <xsl:copy-of> element creates a copy of the current node.

Note: Namespace nodes, child nodes, and attributes of the current node are automatically copied as well!

like image 179
Blair Conrad Avatar answered Nov 16 '22 02:11

Blair Conrad