This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: The XSL-List Digest V3 #329
- To: <xsl-list at mulberrytech dot com>
- Subject: RE: The XSL-List Digest V3 #329
- From: "Peter McEvoy" <peter dot mcevoy at iona dot com>
- Date: Tue, 7 Nov 2000 11:49:12 -0000
- Cc: <mhixson at aventail dot c>
- Reply-To: xsl-list at mulberrytech dot com
> Subject: outputting partial html from a template
>
> I have a chunk of HTML which I would like to put in a header
> template so that I
> can include it at the top of all of my pages. The problem is
> that this chunk
> of HTML has an opening <td> tag, but no closing one. The closing
> </td> will be
> at the end of the page, after the page content (outside of the header
> template). Is there a way in XSL to say "everything within this
> tag should be
> copied literally and not validated by the XSL parser"? I've
> tried <xsl:text>,
> <xsl:copy>, and <xsl:copy-of>.
> I'm using Resin/1.2.b2 and I don't know if this particular
> parser wants all
> tags to be closed within the same template, or if that is a
> general XSL-ism.
> Can I open a <td> tag in one template and close it in another?
> Any help would be appreciated.
> -M@
I must say that I had this exact problem that I wanted to solve, and while
one of the follow-ups suggests that it is not possible, aceiving your end
result IS possible.
For example, take 3 XSL sheets:
Page.xsl
/ \
header.xsl footer.xsl
page.xsl looks something like this (html and xsl has been simplified and
names have been changed to protect the innocent)
-------------------------------------------------------------------------
... header stuff ...
<xsl:include href="header.xsl"/>
<xsl:include href="footer.xsl"/>
<xsl:template match="page">
<HTML>
<HEAD>
<TITLE>Your title</TITLE>
</HEAD>
<BODY>
<center>Welcome
<table>
<tr>
<td>
<xsl:apply-templates select="header">
</td>
</tr>
<tr>
<td>main content</td>
</tr>
<tr>
<td>
<xsl:apply-templates select="header">
</td>
</tr>
</table>
</BODY>
</HTML>
</xsl:template>
then header.xsl actually contains AN ENTIRE table element itself that
formats you header. It still obeys the rules of all tags must be closed:
--------------------------------------
...header stuff....
<xsl:template match="header">
<TABLE>
<TR>
<td> My Header </td>
</TR>
</TABLE>
</xsl:template>
Do the same then for your footer and sure you'll be laughin'...
Pete
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list