[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: why not match text()? (fork from "Novice Question
Yes. In XSLT it's natural to doThis 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) <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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|