I am trying to sorting based on Text - XSLT

前端 未结 3 1595
一个人的身影
一个人的身影 2021-01-23 06:31

I am trying to sorting on text based first text should be upper case then other start with first letter caps or small letter.
Input XML

            


        
3条回答
  •  一个人的身影
    2021-01-23 06:48

    To sort upper-case letters before lower-case letters, use the case-order attribute of xsl:sort.

    Here's a simplified example:

    XSLT

    
    
    
    
        
            
                
                
                    
                
            
        
    
    
    
    

    Result

    
    
      

    B.K.B. v Maui Police Dep’t (9th Cir 2002) 276 F3d 1091:

    BTS, USA, Inc. v Executive Perspectives, LLC (Conn. Super, Oct. 16, 2014, No. X10CV116010685) 2014 Conn Super Lexis 2644, aff’d (Conn App 2016) 142 A3d 342:

    Babcock v Butler County (3d Cir 2015) 806 F3d 153:

    Buxbom v Smith (1944) 23 C2d 535:

    Byrd v Roadway Express, Inc. (5th Cir 1982) 687 F2d 85:

    buySAFE, Inc. v Google, Inc. (Fed Cir 2014) 765 F3d 1350:


    Added:

    I too do not understand what logic you want to implement to get the output you show.

    I am able to get the same output by sorting the nodes in the following order:

    • nodes that begin with initials come first;
    • then sort alphabetically, ignoring case.

    XSLT 2.0

    
    
    
    
    
    
        
            
        
    
    
    
        
            
                
                
            
        
    
    

    Demo: https://xsltfiddle.liberty-development.net/a9GPfN

    
    

提交回复
热议问题