xsl-list
[Top] [All Lists]

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

2007-02-14 10:36:31
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(_dot_)mukul(_at_)gmail(_dot_)com> wrote:
On 2/14/07, John Steel <john(_dot_)steel(_at_)phonewebcam(_dot_)com> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--