Output html with frameset : html « XSLT stylesheet « XML






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>

 








Related examples in the same category

1.Output various html tags
2.Output html img tag
3.One html tag per template
4.Wrap HTML tags in template
5.Format output with HTML tags
6.Construct image name used by generated HTML in style sheet
7.html output method to make br tags come out as
8.Transformation of book information into XHTML with sorting
9.Output whole xhtml document
10.Add more format with html tags
11.Format output with font
12.Use blockquote to output value from xml