[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Limitations of Includes in XSL
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 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. 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|