XSLT StyleSheet XML Tutorial

File: Data.xml 


  
    10-Jun-98
    team 1
    team 2
  

  
    10-Jun-98
    team 3
    team 4
  

  
    16-Jun-98
    team 2
    team 4
  


File: Transform.xslt

  version="2.0">
  
  
  
    
      
        
                  select="count($matches[team=$this])" />
                  select="count($matches[team[.=$this]/@score > team[.!=$this]/@score])" />
                  select="count($matches[team[.=$this]/@score < team[.!=$this]/@score])" />
                  select="count($matches[team[.=$this]/@score = team[.!=$this]/@score])" />
                  select="sum($matches/team[.=current()]/@score)" />
                  select="sum($matches[team=current()]/team/@score) - $for" />
                  drawn="{$drawn}" lost="{$lost}" for="{$for}" against="{$against}" />
      
    

  

Output:

lost="0" for="2" against="1"/>played="2" won="0" drawn="1" lost="1" for="2" against="3"/>
for="2" against="2"/>drawn="2" lost="0" for="3" against="3"/>