Altova Mailing List Archives

Re: [xsl] XHTML templating (best method)

From: Kris Leech <krisleech@--------------->
Date: 1/26/2007 2:58:00 PM
David Carlisle wrote:

By the way how do relative paths work in includes are they relative to

the template with the include? 

You can not have an xsl:include inside a template (your second example

is a syntax error).


Okay, thanks. So that will not work, not the way I have it anyway.


Are there any gotcha's in my reasoning below, other than that they both 
require creating a temporary file which would need a random filename.


sorry I didn't understand why you needed a temporary file here, or what

you mean by the [/FILE] syntax.


I just used [FILE] to show that the first example was one file (two 
files merged in to one) and the second example was two seperate files. I 
should have pointed that out. They where not supposed to be part of the 
XSLT code.

The usual way of sharing common features such as head and foot amongst

multiple stylesheets is you put teh common features in a common

stylesheet and each of the page-specific stylesheets import teh common

core (with the import being a top level instruction, not inside a



Something like this?

<xsl:include href="view.xsl" />
<xsl:template match="/">
<h2>This is the layout</h2>
<xsl:template match="/view">

<xsl:template match="view">
<h3>This the view</h3>
<xsl:value-of select="/a"/>
<xsl:value-of select="/b"/>

In this example like the others I would need to create a temp file 
because view.xsl will not be the real filename of the imported 
stylesheet. It will be a different filename for every URL.


Both URL's use the same layout, but both have a different 'view', so

<xsl:include href="view.xsl" /> needs to be replaced by <xsl:include 
href="dothis.xsl" /> or <xsl:include href="dothat.xsl" /> depending on 
which URL is requested.

I hope that makes sense?



These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.