XSLT StyleSheet XML Tutorial

File: Data.xml


  
    10-Jun-98
    team 1
    team 2
  

  
    10-Jun-98
    team 3
    team 4
  


File: Transform.xslt

  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
    
      
        Date
      
      
        Home Team
      
      
        Away Team
      
      
        Result
      
    
  
  
    
      
        


          Matches in Group
          
        


        
          


                          select="concat(team[1], ' versus ', team[2])" />
          


                      cellpadding="5">
            
            
              
                
                 
              
              
                
                 
              
              
                
                 
              
              
                                  select="concat(team[1]/@score, '-', team[2]/@score)" />
                 
              
            
          
        
      
    
  

Output:

   
      


                   Matches in Group
                   A
      


      

team 1 versus team 2


      
         
            Date
            Home Team
            Away Team
            Result
         
         
            10-Jun-98
                                
                             
            
            team 1
                                
                             
            
            team 2
                                
                             
            
            2-1
                                
                             
            
         
      
      

team 3 versus team 4


      
         
            Date
            Home Team
            Away Team
            Result
         
         
            10-Jun-98
                                
                             
            
            team 3
                                
                             
            
            team 4
                                
                             
            
            2-2