Using Variables in

后端 未结 2 689
一生所求
一生所求 2021-01-04 11:00

Hi am build a generic template to list my content. But the Content may be sorted on different @\'s or node()\'s. So want to pass the xPath in.



        
2条回答
  •  萌比男神i
    2021-01-04 12:00

    This is by design. The select attribute is the only one which doesnt accept AVTs (Attribute - Value Templates).

    The usual solution is to define a variable with the name of the child element that should be used as sort key. Below is a small example:

    
     
    
     
     
    
     
       
        
    
        
       
     
    
    

    When this transformation is applied on the following XML document:

    
      
       2
       4
      
      
       5
       6
      
      
       1
       7
      
    
    

    the wanted result is produced:

    
       5
       6
      
    
       2
       4
      
    
       1
       7
    
    

提交回复
热议问题