This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: making html output for application pages
- From: "J.Pietschmann" <j3322ptm at yahoo dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 19 Apr 2002 23:18:58 +0200
- Subject: Re: [xsl] making html output for application pages
- References: <B8E5FEB0.D892%bernard@liveworld.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Bernie Bernstein wrote:
> When generating the pages, the xsl figures out the general layout of the
> page and values of things like the page title, headers. This requires lots
> of instances of:
>
> <xsl:choose>
> <xsl:when test='/top/page = "index"'>
> <xsl:text>This is the index page</xsl:text>
> </xsl:when>
> <xsl:when test='/top/page = "somePage"'>
> <xsl:text>This is some other page</xsl:text>
> </xsl:when>
> ... and so on for about 30 pages ...
> </xsl:choose>
Well, you can try to leverage the template mechanism.
For example
<xsl:template match="top">
<html>
<head>
<title>
<xsl:apply-template select="page" mode="title"/>
</title>
</head>
<body>
<xsl:apply-template select="page" mode="body"/>
</body>
</html>
</xsl:template>
<xsl:template match="page[.='index']" mode="title">
<xsl:text>Index page</xsl:text>
</xsl:template>
<xsl:template match="page[.='somePage']" mode="title">
<xsl:text>This is some other page</xsl:text>
</xsl:template>
I hope you see the pattern and can extend on it.
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list