Project

Profile

Help

Streamed group-adjacent gives different result for current-grouping-key() than unstreamed grouping

Added by Martin Honnen about 9 years ago

Working with Saxon-EE 9.6.0.4J, I have tried to find a way to use streaming and @group-adjacent@ to group the following input sample:




  
    a
    1
  
  
    a
    2
  
  
    b
    3
  
  
    a
    4
  
  
    a
    5
  

The attempt to use streaming is:









  
    
      
        
      
    
  



That does not build a tree, as far as the output from the @-t@ option seems to indicate, and produces the @group@ elements I want, but has a wrong value for the @key@ attribute in the first group and second group, as the output is



   
      
         a
         1
      
      
         a
         2
      
   
   
      
         b
         3
      
   
   
      
         a
         4
      
      
         a
         5
      
   

When I remove the @<xsl:mode streamable="yes"/>@ and run the stylesheet








  
    
      
        
      
    
  



I get the wanted result



   
      
         a
         1
      
      
         a
         2
      
   
   
      
         b
         3
      
   
   
      
         a
         4
      
      
         a
         5
      
   


Replies (1)

RE: Streamed group-adjacent gives different result for current-grouping-key() than unstreamed grouping - Added by Michael Kay about 9 years ago

Thanks for reporting it.

Logged here: https://saxonica.plan.io/issues/2290

The problem is specific to "grounded grouping" where the grouped items are grounded (typicall by using copy-of). Note that in this case, there are no restrictions on navigating within the current-group() sequence, so Saxon builds each group in memory, and processes it when it finds the first item in the following group. The value of current-grouping-key is being taken from the first item of the next group.

    (1-1/1)

    Please register to reply