Subject: Re: [xsl] text() From: Wendell Piez <wapiez@xxxxxxxxxxxxxxx> Date: Tue, 25 Mar 2014 11:11:02 -0400 |
Dear David, I don't believe anyone in this thread has argued that newcomers should not be forgiven for supposing that 'text()' -- or 'node()' or 'comment()' or now 'element()' and 'attribute()' -- is a function like 'string()' and 'normalize-space()'. To err is human. On the other hand, there's a difference between inferring incorrectly that the thing is a function, and guessing wrong what the function does (or would do were it a function). That's forgiveable too, but one still has to learn what it actually is (a path expression) and actually does (return nodes from the tree). When quizzed on it, I usually tell the critic that the designers simply overloaded the syntax here, rather than introduce a new syntax just for node tests. But the answer to the next question -- whether the principle of parsimony was correctly applied here -- isn't really something we can know, since we don't live in a world where 'text()' is spelled '#text-node' (or whatever). I invite the critic to do this rewriting in his head (for whatever reason it's usually a him), if he likes. He is usually grumpy about this (even while his buddy in the next chair is shrugging amiably). Ihe is right about one thing: this is all about psychology. What it comes down to, I think, is not just that people don't like being exposed in our errancy. Frequently even forgiveness is not enough: we want vindication. While I can't offer that, exactly, I'm happy to tell the critic that he has plenty of company. Cheers, Wendell On Mon, Mar 24, 2014 at 11:05 PM, Birnbaum, David J <djbpitt@xxxxxxxx> wrote: > Dear XSLT List, > > I'm almost afraid to enter this discussion because it has wandered off in > non-productive and sometimes embarrassing directions, but I'll take a > chance and hope that I can say something constructive and useful and that > any responses (not that any are required or expected) will stay on target: > What I found confusing about text() when I first began learning XPath is > that it ends with a pair of parentheses, like string(), which led me to > the erroneous assumption that it was a function, like string(), and not a > node test, like *. That's not a complaint about XPath syntax or even an > inquiry about why things are the way they are. It's just an observation > that in a world where many things that end in a pair of parentheses are > functions, it perhaps shouldn't be surprising that beginners > overgeneralize and assume, incorrectly, that parentheses imply a function > and that text(), therefore, is a function that says "give me all of the > textual content (that is, the string value) of something." > > Best, > > David > -- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] text(), Birnbaum, David J | Thread | [xsl] Map functions in XSLT 3.0 sta, Tony Graham |
Re: [xsl] XSLT Hello World, Ihe Onwuka | Date | Re: [xsl] XSLT Hello World, Wendell Piez |
Month |