How to dynamically change xslt page-sequence based on node attributes?

后端 未结 3 1193
慢半拍i
慢半拍i 2021-01-19 00:10

The watered-down version of the problem I\'m having is this. For an XML file like:



    

        
3条回答
  •  暖寄归人
    2021-01-19 00:36

    Here is an XSLT 2.0 solution that uses xsl:for-each-group with group-adjacent:

    
    
        
        
    
        
          
            
    
              
                
              
    
              
                
                
              
    
              
                
              
    
              
                
              
    
            
            
          
        
    
        
          
    
            
              
                
                  
                    
                      
                    
                  
                
              
    
              
                
                  
                    
                      
                    
                  
                
              
    
            
          
        
    
        
          
            
          
        
    
    
    

    Output:

    
    
       
          
             
          
          
             
             
          
          
             
          
          
             
          
       
       
          
             Item 1
             Item 2
             Item 3
             Item 4
             Item 5
             Item 6
             Item 7
             Item 8
             Item 9
          
       
       
          
             Item 10
          
       
       
          
             Item 11
             Item 12
             Item 13
             Item 14
             Item 15
             Item 16
             Item 17
             Item 18
          
       
    
    

提交回复
热议问题