XSLT sort by tag name and attribute value

前端 未结 3 1505
挽巷
挽巷 2020-12-19 17:16

I\'m a noob with XSLT, so please excuse my ignorance... I\'m trying to sort a simple XML file by attribute value and tag name, but I struggle in accessing the value of the a

3条回答
  •  误落风尘
    2020-12-19 17:43

    You can use multiple xsl:sort instructions, for example:

    
      
        
          
          
        
      
    
    

    and since the default data-type is "text" and the default order is "ascending" this gives the desired output.

    Edit

    This is strange, because for the following XML:

    
        
        
        
        
    
    

    and the XSL above, I get this result:

    
        
        
        
        
    
    

    This includes the desired optional attribute but the order is different to the XML in the edited question ( is in a different position).

提交回复
热议问题