Subject: Separating layout and content
From: "Lensch, Thomas" <Lensch@xxxxxxxx>
Date: Fri, 24 Feb 2006 07:45:19 +0100
|
Hi,
i have several types of documents that i want to display in HTML having
the same overall layout. Doctype specific differences are kept in a
doctype specific stylesheet.
At the moment the following solution works:
1. The doctype specific stylesheet doctypeA.xsl calls
<xsl:call-template name="doLayout"/>
2. doLayout is imported from layout.xsl and looks as follows:
<xsl:template name="doLayout">
<!-- e.g. a rather simple snipet of site layout -->
<table width="100%" cellpadding="3" class="TableRahmenkpl">
<tr valign="top">
<td class="TD">
<xsl:call-template name="navigation" />
<xsl:call-template name="head" />
<xsl:call-template name="title" />
<xsl:call-template name="text" />
</td>
</tr>
</table>
</xsl:template>
3. Each of the doctype specifiy stylesheets holds the above templates
implementing each part of the doctype specific output:
<xsl:template name="navigation">
<!-- output the doctype specific navigation -->
...
</xsl:template>
<xsl:template name="head">
<!-- output the doctype specific head -->
...
</xsl:template>
<xsl:template name="title">
<!-- output the doctype specific title -->
...
</xsl:template>
<xsl:template name="text">
<!-- output the doctype specific text -->
...
</xsl:template>
I wonder whether there is a better way to do this. Any Ideas?
Best regards,
Thomas.
|