Re: [xsl] Peserving html in xsl:value-of select

Subject: Re: [xsl] Peserving html in xsl:value-of select
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Wed, 14 Feb 2007 23:00:19 +0530
On 2/14/07, John Steel <john.steel@xxxxxxxxxxxxxxx> wrote:
Hi,

This is the XML fragment
 <faq>
 <q>
  Question one.
 </q>
 <a>
  The answer is <a href='here.jsp'>here</a>.
  </a>
 </faq>

When I use <xsl:value-of select='a' /> at the appropriate place all I
get out is
The answer is here
 i.e. no tags are preserved.

When you do <xsl:value-of select='a' />, you are printing (to a result tree) the string value of the element node (whose name is "a"). The string value of element node is defined as the concatination of all descendant text nodes.

The solution to this problem is (as others have said) - use
xsl:copy-of (which does a deep copy of a node to the result tree).

--
Regards,
Mukul Gandhi

Current Thread