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

Re: Limitations of Includes in XSL

Subject: Re: Limitations of Includes in XSL
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 25 Apr 2000 15:24:13 -0400
fop xsl include template
At 00/04/25 13:52 -0500, Ken Burnside wrote:
What I've been trying to do is a trick I've used as a web developer -- the
metaphorical equivilant of server side includes in the XSL file. Rather
than cut and paste a filing and disposition control table like this

(Warning -- long code block that probably doesn't have enough space for its
indents...)
...
from XSL file to XSL file.  Obviously, much was elided from the sample
above, but the table is easily 60 lines of code, that's replicated through
90% of what I'm working on.

I'd prefer to put it as a separate file, and call it as such:

<xsl:include href="filingAndDispo.xsl">

I'm running into two problems:

1) The XML parser (FOP) says that I cannot use an include inside of a
template.  I'm trying to see if I can summon the include outside the
template and call the results from within it, but I confess to floundering
a lot.

Thankfully, it is quite straightforward. In your template, use <xsl:call-template name="named-thingy"/>, and then at the top level (between templates) you can <xsl:include> the stylesheet fragment that has <xsl:template name="named-thingy"/>.


Personally, I use <xsl:import> rather than <xsl:include> as it allows me to override what I'm importing (not possible with include, which may introduce template conflicts) if I need to.

2) The other issue I'm running into is passing the appropriate root
document to the XSL widget that's called by the include.

That which is included or imported is a fully-formed XSLT stylesheet itself, so its document element is either <xsl:stylesheet> or <xsl:transform>.


Once you get the hang of this, you can really exploit a lot of fragments you create in different ways. It can save a lot of time on development and on maintenance.

I hope this helps.

................... Ken

--
G. Ken Holman                    mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Web site: XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath      ISBN 1-894049-04-7
Next instructor-led training:    2000-05-02,2000-05-11/12,2000-05-15,
-                                    2000-06-12,2000-06-13,2001-01-27


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.