[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XHTML templating (best method)

Subject: Re: XHTML templating (best method)
From: Kris Leech <krisleech@xxxxxxxxxxxxxxx>
Date: Fri, 26 Jan 2007 14:57:28 +0000
Re:  XHTML templating (best method)
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
template)


Something like this?

[FILE]
<xsl:include href="view.xsl" />
<xsl:template match="/">
<html>
<body>
<h2>This is the layout</h2>
<xsl:template match="/view">
</body>
</html>
</xsl:template>
[/FILE]

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

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.
eg.


abc.com/dothis.htm
abc.com/dothat.htm

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?

David

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.