XSL recursive sort

后端 未结 3 1812
清歌不尽
清歌不尽 2021-01-19 08:45

I am facing a problem where I need to sort elements, depending on their value, which contains a numbers, separated by periods. I need to sort elements depending on the value

3条回答
  •  旧巷少年郎
    2021-01-19 09:05

    It's not pretty but you can use the xalan:nodeset function to "pre-process" the numbers into a nodeset with an easily sortable expression as described by Jim.

    This example works for me with Xalan 2.5.1:

    
    
    
    
    
    
    
        
            
            
                
                    
                        
                            
                        
                    
                    
                        
                    
                
            
    
            
            
                
                
            
        
    
    
    
        
        
        
        
            
                
                
                    
                
            
            
                
            
        
    
    

    I personally think writing an extension function would be preferable, but I know that's it's not always an option.

提交回复
热议问题