Subject: Re: [xsl] When to use text() From: Michael Kay <mike@xxxxxxxxxxxx> Date: Fri, 21 Mar 2014 11:37:18 +0000 |
On 21 Mar 2014, at 11:08, Heiko Niemann <kontakt@xxxxxxxxxxxxxxxx> wrote: > 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> In such content you should NOT use text(). If you do, your code will fail in the presence of comments such as <item>appel<!--sic--> pie</item> and it's good practice that comments should not affect the result of processing. > So this leaves the question: when actually use text()? > Only use it if you need to process the text node children and element children of a mixed-content element individually. Michael Kay Saxonica
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] When to use text(), Heiko Niemann | Thread | Re: [xsl] When to use text(), Wendell Piez |
[xsl] When to use text(), Heiko Niemann | Date | Re: [xsl] When to use text(), Wendell Piez |
Month |