Subject: Re: [xsl] Determine if an element with descents has complete empty text content From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 3 Oct 2016 07:38:48 -0000 |
> I thought that the simpler expression below with a decent optimizer > will be as efficient as the above: > > exists($context[normalize-space()]) > > as it is sufficient to find the first non-empty text() descendent to > conclude that the argument to the exists() function is the $context > element. > Saxon does part of this optimization - normalize-space() in a boolean context is evaluated by scanning the string until a non-whitespace character is found (effectively rewriting as a function call contains-non-whistespace()). It doesn't do the other half, recognizing that contains-non-whitespace($element) can be evaluated as exists($element//text()[contains-non-whitespace(.)]). There's always scope for more such optimizations, but there's a law of diminishing returns. It's not unusual to find that some such optimization isn't triggered by a single one of the 30,000 QT3 test cases, and then you have to ask whether it's worth implementing. Michael Kay Saxonica
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Determine if an element w, Dimitre Novatchev dn | Thread | Re: [xsl] Determine if an element w, Mukul Gandhi gandhi. |
Re: [xsl] Determine if an element w, Mukul Gandhi gandhi. | Date | [xsl] Doing Math on Durations and C, Eliot Kimber ekimber |
Month |