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

Subject: Re: [xsl] Peserving html in xsl:value-of select
From: Steve <subsume@xxxxxxxxx>
Date: Wed, 14 Feb 2007 12:35:53 -0500
Because, after all, isn't that industrious little <a> tag just HTML
who doesn't realize he's XML too? And so when XML wants to know his
value, all he has to show for himself is 'Click here'. But he's more
than that. Much more.

-S

On 2/14/07, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote:
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