[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] When to use text()
Hi, I noticed in my code that I sometimes use text() to select a text node and sometimes I don't. I do understand that /foo is different to /foo/text() if foo has mixed content. But if I have a simple source like <box> <item>apple</item> </box> then I can't tell a difference for /box/item and /box/item/text() using value-of. I understand that value-of actually selects the value ('apple') of the node (/box/item). Does that mean that using /box/item/text() is wrong, unnecessary or just a matter of style or performance? Same applies to using the if-element: <xsl:if test="/box/item eq 'apple'"> or <xsl:if test="/box/item/text() eq 'apple'"> ?? I noticed that I more often used text() in if-elements like this, probably 'to really make sure' to select a string to compare. Which was probably a silly assumption whenever I wrote that code. So this leaves the question: when actually use text()? Regards, Heiko
|
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
|