How to use group by in xslt

后端 未结 2 555
长情又很酷
长情又很酷 2021-01-06 02:18

I have a xml that has so many elements and most of that contain attributes.. for some of the attributes values are same so I need to group them and generate diff xml. I/p Ex

2条回答
  •  青春惊慌失措
    2021-01-06 03:17

    In XSLT 1.0 you would use Muenchian grouping.

    Define a key "format", from which we can easily select all elements given a format name. Than apply Muenchian grouping to find the unique formats in the input.

    Then it gets simple. The "*" template will be applied once per format, and uses the key() to fetch all entries for that format.

    
    
        
    
        
    
        
            
                
            
        
    
        
            
              
            
        
    
    
    

提交回复
热议问题