Subject: [xsl] xsl:include blues.. From: "Kevin Duffey" <kevin.duffey@xxxxxxxx> Date: Tue, 13 Feb 2001 00:30:32 -0800 |
Hi there, I am having two dilemas with using an XSL include. First, I want to include a "header" and "footer" on every page. The header would be the opening HTML (<html><head></head><body>), and the footer would be the closing </body></html>. I thought of putting these in a "library" of templates, so that I can match a <header> and <footer> tag in the source XML, but apparently you have to close the tags you open even in a template. I figure the resulting XML had to be well-formed. For example, here is a snippet of xsl I thought would work: ----------- include.xsl ----------- <xsl:template match="header"> <html> <head> </head> <body> </xsl:template> <xsl:template match="footer"> </body> </html> </xsl:template> ------------ somepage.xsl ------------ <xsl:include file="include.xsl"/> <xsl:template match="ob"> <xsl:apply-templates select="header"/> ... some HTML <xsl:apply-templates select="footer"/> </xsl:template> I am not sure why the above doesn't work, but I assume its because the templates must be well-formed? So the question is, how can I include the same "header" and "footer" in every XSL page so that I can use a consistent look to my site, but still get the benefits of using XSL? On that note, an odd thing happens and I am not sure if there is a way to circumvent this problem. I am using Java (J2EE specifically) and following the web application (WAR) format. In that format the ROOT of a web-app is the start of the www folder. In other words, in any path info the "/" defines the root of the web app, which is the www folder. When I try to include an XSL file and use something like <xsl:include href="/path/page.xsl"/> it does NOT use my root web app, but instead seems to be looking in the dir of the app server I am using (Orion App server). I am using the latest Xerces with TrAX API, and am using saxon, as well as have tried with the latest xalan. I am unclear why the xsl:include is not looking in my web application root. Can anyone shed light on this as well? Thanks very much. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Can XSLT output Barcode c, Jarno Elovirta | Thread | Re: [xsl] xsl:include blues.., Robert Koberg |
RE: [xsl] XSLT 1.1 comments, DPawson | Date | RE: [xsl] Can XSLT output Barcode c, Kevin Duffey |
Month |