Mega Code Archive

 
Categories / XML / XSLT StyleSheet
 

Output html with frameset

File: Data.xml <?xml version = "1.0" encoding = "UTF-8"?> <employees>   <employee eid="1" dept="programming">     <contact addInfo="info1">       <name>         <firstName>Joe</firstName>         <middleName int="B">Brian</middleName>         <lastName>Smith</lastName>       </name>       <address>         <street>1 Drive</street>         <city>Vancouver</city>         <state>BC</state>         <zipcode>80210</zipcode>       </address>       <phone>         <tel type="wk">111-1111111</tel>         <tel type="hm">222-222222</tel>         <fax>303-4667357</fax>       </phone>       <email>a@a.com</email>     </contact>     <hireDate>2008-10-29</hireDate>   </employee>   <employee eid="2" dept="training">     <contact addInfo="info2">       <name>         <firstName>Sam</firstName>         <middleName int="S">Stolte</middleName>         <lastName>Williams</lastName>       </name>       <address>         <street>1 St.</street>         <city>Austin</city>         <state>Texas</state>         <zipcode>22222</zipcode>       </address>       <phone>         <tel type="wk">512-3467899</tel>         <tel type="hm">512-4623356</tel>         <fax>512-3465655</fax>       </phone>       <email>s@s.com</email>     </contact>     <hireDate>2000-03-11</hireDate>   </employee> </employees> File: Transform.xslt <?xml version="1.0"?> <xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">   <xsl:template match="/">     <html>       <head>         <title>Frame Document</title>       </head>       <frameset cols="30%,*">         <frame src="nav.html" />         <xsl:document href="nav.html">           <html>             <head>               <title>Navigation</title>             </head>             <body>               <xsl:apply-templates mode="nav" select="*" />             </body>           </html>         </xsl:document>         <frame src="body.html" />         <xsl:document href="body.html">           <html>             <head>               <title>Email Listing</title>             </head>             <body>               <xsl:apply-templates select="*" />             </body>           </html>         </xsl:document>       </frameset>     </html>   </xsl:template> </xsl:stylesheet>