Subject: Re: [xsl] When to use text()|
From: Ihe Onwuka <ihe.onwuka@xxxxxxxxx>
Date: Fri, 21 Mar 2014 17:44:26 +0000
On Fri, Mar 21, 2014 at 5:40 PM, Graydon <graydon@xxxxxxxxx> wrote: > On Fri, Mar 21, 2014 at 05:19:32PM +0000, Ihe Onwuka scripsit: >> The quirkiness of the definition derives not from the definition >> itself, because there may well be justification for the existence of a >> node type that encompasses text with embedded comments. Thats OK. > > There isn't, though. text nodes have no name and a string and no node > children. > > Text nodes are guaranteed leaves, like everything else except for > element nodes and document nodes. > >> The quirkiness derives from giving it an innocuous intuit inducing >> moniker like text() that leads the consumer astray. >> >> Let me parallel. If you call a concept Nothing and then occasionally >> allow it to contain Something, RTFTM is not appropriate because the >> fault lies in labelling that concept Nothing. > > But it doesn't. The parent element does. The issue is not that there > might be a comment node in the text node, but that there might be a > comment node child of the parent element node that separates the string > contents of the element into two or more text node children. > If it's a guaranteed leaf you shouldn't get the contents of anything else when you ask for it.