In continuation to my XSLT work, I had to ratin all the HTML tags which were part of the XML elements. For example consider following XML document
<root>
<element>
Text goes here with bullets <ul><li>Item 1<li><li>Item 2</li></ul>
</element>
</root>
Here, if we capture the element with the following line in XSLT, all the HTML tags will be stripped off.
<xsl:value-of select=”element”/>
That is result will not shown as a bullet list, rather it will be shown as plain text.
Instead if you use following code in XSLT, all your HTML tags will be retained.
<xsl:copy-of select=”element”/>
Reason being: “copy-of” Creates a copy of the current node (with child nodes and attributes) where as “value-of” Extracts the value of a selected node.
Here is the bottom line: If you want to extract the value use “value-of”, if you want the value present in the xml element as it is, use copy-of.
Here is a list of XSLT Elements for your quick reference.