Persaonlly, if youre just concerned about formatting, Id use CSS, buuut Ok.
You have a few choices. You can use your html template as the source xml file and transform it with something like ChordedZithers template (though I havent seen a ‘template select’ before, is that a typo?). Going that route Id probably write the xsl a bit different, but its not a major deal.
Or, you can write something like this, that has most of the basic html markup in the xsl template itself. Since Im assuming the title info and content would be associated together for the pages they go to, it would make sense that the title info and content are at the least siblings. Also, PAGE_TITLE is confusing, as its really the header, and not the title. Personally, Id pass the username and current time in your footer as a parameter to the xsl.
Sample xml feed (just an example):
<XML>
<PAGE_HEADER>Welcome</PAGE_HEADER>
<PAGE_CONTENT>
Welcome to my wonderful web site.
Blah Blah blah, lots of text
A few images. Some more chat.
General HTML text.
</PAGE_CONTENT>
</XML>
Sample xsl:
<?xml version=‘1.0’?>
<xsl:stylesheet xmlns:xsl=‘http://www.w3.org/1999/XSL/Transform’ version=‘1.0’>
<!-- output as xml to preserve the well-formedness and readability -->
<xsl:output method=“xml” omit-xml-declaration=“yes” indent=“yes”/>
<!-- default the user and time to empty just in case -->
<xsl:param name=“user” select=""/>
<xsl:param name=“time” select=""/>
<xsl:template match="/">
<HTML>
<HEAD><TITLE>My wonderful web page</TITLE></HEAD>
<BODY>
<xsl:apply templates select=“PAGE_HEADER”/>
<xsl:copy-of select=“PAGE_CONTENT”/>
<xsl:apply templates select=“PAGE_FOOTER”/>
</BODY>
</HTML>
</xsl:template>
<!-- ideally these would be in a seperate, imported xsl file -->
<xsl:template match=“PAGE_HEADER”>
<TABLE>
<TR bgcolor=“orange”>
<TD><IMG source=“start.gif” /></TD>
<TD>
<font size=“5”>
<xsl:value-of select="."/>
</font>
</TD>
<TD><IMG source=“end.gif” /></TD>
</TR>
</TABLE>
</xsl:template>
<xsl:template match=“PAGE_FOOTER”>
<TABLE>
<TR bgcolor=“orange”>
<TD> <font size=“2”>logged in as: </TD>
<TD> <font size=“2”><strong><xsl:value-of select="$user"/></strong></TD>
<TD> <font size=“2”>at </TD>
<TD> <font size=“2”><strong><xsl:value-of select="$time"/></strong></TD>
</TR></TABLE>
</xsl:template>
</xsl:stylesheet>
The advantage to using either this or ChordedZithers template is you can cache the result. If you cache though you need to make sure the username and time are passed as params.
If you are really hell bent on using data islands, you have to use javascript, as the client has to do the parsing, and this is basically how its done:
====the html page=============================
<HTML>
<HEAD>
<TITLE>My wonderful web page</TITLE>
<script type=“text/javascript”>
function transformMe(){
var StyleOb = new ActiveXObject(“MSXML2.DOMDocument.3.0”);
StyleOb.async = false;
StyleOb.load("header.xsl");
document.all('header').innerHTML = TOP.transformNode(StyleOb);
StyleOb.load("footer.xsl");
document.all('footer').innerHTML = END.transformNode(StyleOb);
StyleOb = null;
}
onload = transformMe;
</script>
</HEAD>
<BODY>
<XML ID=“TOP”>
<PAGE_TITLE>Welcome</PAGE_TITLE>
</XML>
<div id=“header”>
</div>
Welcome to my wonderful web site.
Blah Blah blah, lots of text
A few images. Some more chat.
General HTML text.
<XML ID=“END”>
<FOOTER>
<LOGIN_NAME>Clive Jones</LOGIN_NAME>
<LOGIN_TIME>11:15 AM</LOGIN_TIME>
</FOOTER>
</XML>
<div id=“footer”>
</div>
</BODY>
</HTML>
=====header.xsl=============================
<?xml version=‘1.0’?>
<xsl:stylesheet xmlns:xsl=‘http://www.w3.org/1999/XSL/Transform’ version=‘1.0’>
<!-- output as xml to preserve the well-formedness and readability -->
<xsl:output method=“xml” omit-xml-declaration=“yes” indent=“yes”/>
<xsl:template match=“PAGE_TITLE”>
<TABLE>
<TR bgcolor=“orange”>
<TD><IMG source=“start.gif” /></TD>
<TD><font size=“5”><xsl:value-of select="."/></font></TD>
<TD><IMG source=“end.gif” /></TD>
</TR>
</TABLE>
</xsl:template>
</xsl:stylesheet>
=====footer.xsl==================================
<?xml version=‘1.0’?>
<xsl:stylesheet xmlns:xsl=‘http://www.w3.org/1999/XSL/Transform’ version=‘1.0’>
<!-- output as xml to preserve the well-formedness and readability -->
<xsl:output method=“xml” omit-xml-declaration=“yes” indent=“yes”/>
<xsl:template match="/">
<TABLE>
<TR bgcolor=“orange”>
<TD> <font size=“2”>logged in as:</font> </TD>
<TD> <font size=“2”><strong><xsl:value-of select=“FOOTER/LOGIN_NAME”/></strong></font></TD>
<TD> <font size=“2”>at </font></TD>
<TD> <font size=“2”><strong><xsl:value-of select=“FOOTER/LOGIN_TIME”/></strong></font></TD>
</TR>
</TABLE>
</xsl:template>
</xsl:stylesheet>
Hope this helps.