This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: !!!showing HTML data in XML files using XSL!!!
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] !!!showing HTML data in XML files using XSL!!!
- From: Mike Brown <mike at skew dot org>
- Date: Thu, 29 Mar 2001 22:47:57 -0700 (MST)
- Reply-To: xsl-list at lists dot mulberrytech dot com
Rosa I-Ting Cheng wrote:
> XML:
> <root>
> <text><I><B>here is some info</B></I></text>
> </root>
>
> in XSL I'll be using <xsl:value-of select="root/text"/> to show the info.
Why won't you be using <xsl:copy-of select="root/text"/> ?
xsl:value-of means
1. create a text node in the result tree
2. make it contain the string-value of the first node in the selected node-set
In the XPath spec it says exactly how to figure out the string-value of each
type of node. Element nodes like your 'text' element above have a
string-value that is the concatenation of all descendant text nodes of that
element.
xsl:copy-of means
1. create a copy of the current node in the result tree
2. create copies of all its descendant nodes as well
This is what you want. Don't use CDATA sections. If you really wanted to use
them, you would use them in your XML, not your XSL, and you would be changing
the meaning of what is inside your <text> element.
- Mike
_____________________________________________________________________________
mike j. brown, software engineer at | xml/xslt: http://skew.org/xml/
webb.net in denver, colorado, USA | personal: http://hyperreal.org/~mike/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list