Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 16th, 2008, 04:13 AM
Authorized User
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Performance for <xsl:import> and <xsl:include>

Hi,

Is there any performance issues if we use <xsl:import> or <xsl:include>. Also are these two tags only helped to provide more clear code or any more advantages for using these two tags. Thanks in advance for your help.

 
Old April 16th, 2008, 05:21 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

<xsl:include> is literally like if you cut and pasted the included stylesheet into the one with the xsl:include line in, so other than a small hit to actually find and read the stylesheet its not going to make any difference.

xsl:import is slightly more complicated in that it has a lower precedence than the importing stylesheet, so if there are conflicting templates it may take longer to work out which one to call.

Having said that all of these things are effectively 'static' i.e. they don't change at runtime, so once your processor has run through the stylesheet and compiled it the actually processing will make no difference. Some processors (e.g. Saxon) even provides the facility to save the compiled stylesheet out if you are going to be running it over and over again, which I suspect will improve performance greatly.

Both top-level declarations (the technical term, much better than using 'tag' which can be misleading) have many benefits over simply making the code cleaner. They provide facilities for re-use, as well as the precedence facilities of xsl:include allowing you to effectively 'overload' a particular template in the parent stylesheet, in a similar style of abstract classes and class inheritance in object oriented programming languages.

/- Sam Judson : Wrox Technical Editor -/
 
Old April 16th, 2008, 08:06 AM
Authorized User
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thx for your detailed response.






Similar Threads
Thread Thread Starter Forum Replies Last Post
embedded <xsl:element> into <xsl:with-param> petergoodman XSLT 2 July 9th, 2008 06:36 AM
Can you use <xsl: import> and transform to a pdf? wiegandn XSLT 1 August 8th, 2007 01:23 PM
<xsl:for-each> inside another <xsl:for-each> suersh79 XSLT 2 December 29th, 2006 01:24 AM
<xsl:choose> and <xsl:otherwise> problem djmarquette XSLT 4 January 21st, 2005 01:56 PM
HELP: XSL -> HTML <select selected=true> jedbartlett XSLT 4 October 7th, 2004 11:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.