This might be a common problem from people coming from XQuery... in
XSLT we get the string value of the element or attribute, in XQuery
you get the deep-copy, so there is the habit of specifying string()
everywhere (or text() in the past)
Yes. In XSLT it's natural to do
<book><xsl:value-of select="title"/></book>
In XQuery it's best to do
<book>{string(title)}</book>
but many examples and tutorials encourage
<book>{title/text()}</book>
which works fine until someone has a title that reads:
<title>On the freezing point of H<sub>2</sub>O</title>
As to using template rules that match text nodes, I think the discussion
we've been having shows that it's legitimate if you have mixed content
and need to something with the content of the text other than copying it
or discarding it; but you do need to be aware that the text can be split
up into multiple text nodes by comments or other markup.
Michael Kay
Saxonica
--~------------------------------------------------------------------
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>
--~--