Hall, Joe wrote:

Is it possible to use different custom stylesheets (layouts)? You can use xsl:include to create a "TemplateMethod" type of xsl for this layout system. I did something similar with my current project.

Example LayoutTemplate.xsl (Contains common xslt):
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:include href="header.xsl"/>
<xsl:include href="footer.xsl"/>
<xsl:template match="/">
<html>
<!-- a bunch of stuff -->
<xsl:call-template name="header"/>
<xsl:call-template name="menu-section"/>
<xsl:call-template name="content-section"/>
<xsl:call-template name="footer"/>
</html>
</xsl:stylesheet>


Example CustomLayout.xsl (Contains page/client specific formatting):
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template name="menu-section">
<!-- do stuff custom for this layout -->
</xsl:template>
<xsl:template name="content-section">
<!-- do stuff custom for this layout -->
</xsl:template>
<xsl:include href="LayoutTemplate.xsl"/
</xsl:stylesheet>


I would keep the xml pure data and use xslt to provide the XHTML formatting. This will make using the same model easier for different views (html, wml, custom app, etc...).

I hope this helps.



this sound like a good idea. thx very much
never thought of xslt that way. i guess i'm gonna try this one
for a better overview are there other approaches ?

regards nicolas



Reply via email to