Project

Profile

Help

using pattern match="descendant::text()[normalize-space()][1] gives warning "The descendant axis starting at a text node will never select anything"

Added by Martin Honnen almost 10 years ago

I have another problem trying to use a pattern with the descendant axis. The stylesheet is









  
    
  



the sample XML is



  
     
     1
     2
     
  
  
     a
  
  
     d1
      
       d2
      
  
  
     
      X
     
  

then all Saxon 9.6.0.3 EE outputs is


Warning: on line 7 of test2015010409.xsl:
  The descendant axis starting at a text node will never select anything

When I omit the positional predicate @[1]@ I get the result



1
2
a
d1
d2
X

so the pattern does select something, I don't understand the warning.


Replies (1)

RE: using pattern match="descendant::text()[normalize-space()][1] gives warning "The descendant axis starting at a text node will never select anything" - Added by Michael Kay almost 10 years ago

Another bug, related to 2277 but different: I have logged it at

https://saxonica.plan.io/issues/2278

and added the W3C test case match-236.

The warning happens because the type inferencing wrongly infers that the descendant::text() is being evaluated with a text node as the context item; having made this incorrect inference, it not only issues the spurious warning, but it also substitutes the pattern with one that will immediately return a "no-match" response.

    (1-1/1)

    Please register to reply