RE: The XSL-List Digest V3 #329

Subject: RE: The XSL-List Digest V3 #329
From: "Peter McEvoy" <peter.mcevoy@xxxxxxxx>
Date: Tue, 7 Nov 2000 11:49:12 -0000
> 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:

             /    \
   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">
      <TITLE>Your title</TITLE>
                  <xsl:apply-templates select="header">
                <td>main content</td>
                  <xsl:apply-templates select="header">

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">
      <td> My Header </td>

Do the same then for your footer and sure you'll be laughin'...


 XSL-List info and archive:

Current Thread