Rotate background color without using for-each

后端 未结 3 723
遇见更好的自我
遇见更好的自我 2021-01-24 19:38

I am trying to set the background color of every other I am not using a for-each loop since I am using a few templates to filter data based on the nodes

3条回答
  •  一生所求
    2021-01-24 20:11

    Here is the classic XSLT solution:

    Replace:

         
             
         
    

    with:

            
             
               
             
           
    
           
    

    Replace your element with:

    
    
     
      #ffff
      #cccc
     
    
     
    

    Finally, add this template:

     
      
     
      
      
        
      
    
      
     
     
    

    The complete XSLT code becomes:

    
    
     
      #ffff
      #cccc
     
    
     
    
     
           
                
                 
                     
                       
                     
                   
                 
    Agent Name State Time

    When applied on the provided XML document:

    
      
        MCCALLISTER AARON
        Talking Out
        
        
      
      
        APPELHANS BARRY
        Talking Out
        
        
      
      
        ARREDONDO KARLA
        Talking Out
        
        
      
    
    

    the wanted, correct result is produced:

    
       
          
    Agent Name State Time
    MCCALLISTER AARON Talking Out 9
    APPELHANS BARRY Talking Out 1
    ARREDONDO KARLA Talking Out 0

提交回复
热议问题