Project

Profile

Help

question about using descendant axis in pattern

Added by Martin Honnen almost 10 years ago

I am struggling to understand the result Saxon 9.6.0.3 EE gives me when I use a pattern @chapter/descendant::foo[1]@ with the descendant axis. Sample stylesheet is









  
    
  



sample input is




  
     
     1
     2
     
  
  
     a
  
  
     d1
      
       d2
      
  
  
     
      X
     
  

the result I get is




   1


   a


   d1


   d2

while I would expect to get




   1


   a


   d1

When I try to use descendant with pull style processing, as in the file







  
    
      
    
  



then I get the wanted result. I don't understand why the pattern based use gives a different result, is that a bug in Saxon or is my understanding of the use of the descendant axis in a pattern like @match="chapter/descendant::foo[1]"@ flawed?


Replies (2)

RE: question about using descendant axis in pattern - Added by Michael Kay almost 10 years ago

This looks like a bug. I've raised a bug entry at

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

and have added the test case to the W3C test suite.

RE: question about using descendant axis in pattern - Added by Michael Kay almost 10 years ago

It seems that FirstItemExpression.toPattern() should check that the base expression is an axis step using the child axis before generating a SimplePositionalPattern.

    (1-2/2)

    Please register to reply