This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: header/footer: How to to separate html-tag in to different xsl-template rules?
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: header/footer: How to to separate html-tag in to different xsl-template rules?
- From: Linda van den Brink <lvdbrink at baan dot nl>
- Date: Fri, 23 Jun 2000 13:12:38 +0200
- Reply-To: xsl-list at mulberrytech dot com
>
> How could I separate headers and footers in my xsl-templates?
> My problem
>
> is, that I cannot have a tag like "body" in an
> <xsl:template>, whithout
> closing it.
>
> So how to do:
>
> <xsl:template match="header">
> <html>
> <head>
> </head>
> <body>
> </xsl:template>
>
> <xsl:template match="footer">
> </body>
> </html>
> </xsl:template>
You need to change the way you look at this. Remember that your XML
document, the input, has a tree structure, and the XSLT processor also wants
to output a tree structure. The processor walks through the input tree and
fires up the template that matches each element it encounters.
So if you have:
<document>
<header>stuff</header>
<middlepart>more</middlepart>
<footer>end</footer>
</document>
and
xsl:template match="document"
<html><head/><body><xsl:apply-templates></body></html>
and templates for header, middlepart, and footer, the xsl:apply-templates
will cause the processor to fire up the header, middlepart, and footer
templates one after the other and the output will be generated for these
elements inside the <body> element.
Hope this helps,
Linda
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list