Subject: RE: [xsl] Headers 'n Footers 'n XSL From: "Tim Watts" <timw@xxxxxxx> Date: Wed, 21 Mar 2001 09:41:10 +1100 |
Hi Jon, I'm working on a project which has standard headers and footers, and we use the following to call the include files; <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:include href="../document.xsl" /> <xsl:param name="title">Search Results</xsl:param> <xsl:template name="body"> <!-- your data here --> </xsl:template> </xsl:stylesheet> to call the document.xsl which is like so: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="*"/> <!-- The main template that wraps the html tags, header and footer content around the body template --> <!-- when it finds the top level xml tag (document in my case) the template is called --> <xsl:template match="document"> <html lang="EN-US" dir="LTR"> <head> <script type="text/javascript" language="javascript"> <!-- any javascript you may want here --> </script> <link rel="stylesheet" type="text/css" href="stylesheet.css"/> <title><xsl:value-of select="$title"/></title> </head> <body> <!-- Your header info here --> <xsl:call-template name="body"/><!-- this calls the body template in the main xsl --> <!-- Your footer info here --> </body> </html> </xsl:template> You will notice that each page has its own title because of the param in the original xsl Hope that this has been helpful. Tim Watts -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Jon Wynacht Sent: Wednesday, 21 March 2001 8:09 AM To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Headers 'n Footers 'n XSL Howdy, I was wondering if anybody on this list has ever worked with headers and footers and XSL. What I mean is that you have a site or an app that has the same header, the same footer but the content differs in the middle. What I'd like to do is have xsl for the particular pages that are getting generated but call an external source for the header and footer so as to not recreate the same html all over again. Makes it easy to update headers and footers too. I did this in the past when the XSL spec was in its infancy but since then it doesn't seem like there's an easy way to do this. I was thinking <xsl:import> or <xsl:include> Any ideas? Thanks, Jon XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Headers 'n Footers 'n XSL, Arni J Rognvaldsson | Thread | RE: [xsl] Headers 'n Footers 'n XSL, Lors, Ben |
[xsl] Merging two XML documents, Arni J Rognvaldsson | Date | RE: [xsl] xsl stylesheet collection, Tim Watts |
Month |