/Users/lyon/j4p/src/xml/musicCatalog/MusicCatalog.xsl

1    <?xml version="1.0" encoding="ISO-8859-1"?> 
2     
3    <xsl:stylesheet  
4        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
5        version="1.0"> 
6         
7        <xsl:output method="html"/> 
8         
9            <!-- Match the root element --> 
10           <xsl:template match="/"> 
11               <html> 
12                   <body> 
13                       <h2>My Music Catalog</h2> 
14                       <xsl:apply-templates/> 
15                   </body> 
16               </html> 
17           </xsl:template> 
18            
19           <!-- Match the children of root --> 
20           <xsl:template match="/MusicCatalog/Item"> 
21               <xsl:apply-templates/> 
22               <hr/> 
23           </xsl:template> 
24    
25           <!-- Match the remaining children --> 
26           <xsl:template match="/MusicCatalog/Item/Artist"> 
27               Artist: <xsl:apply-templates/> 
28               <br/> 
29           </xsl:template> 
30    
31           <xsl:template match="/MusicCatalog/Item/Title"> 
32               Title: <xsl:apply-templates/> 
33               <br/> 
34           </xsl:template> 
35    
36           <xsl:template match="/MusicCatalog/Item/Year"> 
37               Year: <xsl:apply-templates/> 
38               <br/> 
39           </xsl:template> 
40    
41           <xsl:template match="/MusicCatalog/Item/Member"> 
42               Member: <xsl:apply-templates/> 
43               <br/> 
44           </xsl:template> 
45    
46    
47   </xsl:stylesheet> 
48    
49