Subject: Re: [xsl] XHTML templating (best method) From: Kris Leech <krisleech@xxxxxxxxxxxxxxx> Date: Fri, 26 Jan 2007 17:39:19 +0000 |
That works great thanks! Except generalCase.xsl should not have the import. I renamed mine to layout.xsl (aka generalCase.xsl) and list.xsl (aka specialCase.xsl).
That would be a better way around but I can't see a way to wrap the page-specific stylesheets in the common one without breaking the common stylesheet in two stylesheets, top and bottom, or am I missing the point.
Something like this:
[specialCase.xsl]
<xsl:stylesheet>
<xsl:import href="generalCase.xsl"/>
<xsl:template match="/" mode="page-specific"> ... generate page-specific content ... </xsl:template>
</xsl:stylesheet>
[generalCase.xsl]
<xsl:stylesheet>
<xsl:import href="generalCase.xsl"/>
<xsl:template match="/"> <boilerplate> <xsl:apply-templates select="." mode="page-specific"/> </boilerplate> </xsl:template>
</xsl:stylesheet>
The detail can vary, depending on how much common structure there is between
the different XML source documents. As shown above, it works with no common
structure at all: the only thing the general-purpose stylesheet does it to
wrap a standard boilerplate around the page-specific output.
<?xml version="1.0" encoding="UTF-8"?> <data> <title>List of people</title> <people> <person id="1"> <firstname>Harry</firstname> <lastname>Love</lastname> </person> <person id="2"> <firstname>Tim</firstname> <lastname>Burton</lastname> </person> </people> </data>
Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XHTML templating (best me, Michael Kay | Thread | Re: [xsl] XHTML templating (best me, Jonas Lundberg |
[xsl] Grouping based on the sum of , Spencer Tickner | Date | Re: [xsl] Grouping based on the sum, David Carlisle |
Month |