[xsl] Importing stylesheet

Subject: [xsl] Importing stylesheet
From: Adam Van Den Hoven <Adam.Hoven@xxxxxxxxxxxx>
Date: Tue, 26 Jun 2001 22:34:29 -0700
Hey guys, 

I'm looking for a bit of confirmation. I've gone through Mike Kay's book but
I want to clear up the last bit of confusion. 

I have a library stylesheet that contains among other things a default
wrapper for the HTML I create. The library is (approx):
<xsl:template name="DefaultWrapper">
  <xsl:with-param name="innerHTML" />
  <html><head><xsl:call-template name="getJSCode"
/></head><body><xsl:copy-of select="innerHTML" /></body></html
<xsl:template name="getJSCode">
function doThis(){alert('Default this');}
function doThat(){alert('Defualt that');}

I have another (many others) stylesheet that imports this one it looks
something like:
<xsl:import href="lib.xsl" />
<xsl:template match="/">
 <xsl:call-template name="DefaultWrapper">
   <xsl:with-param name="innerHTML">
     <p><strong><a href="javascript:doThis()">Hello World</a></b></p>
     <p><strong><a href="javascript:doThat()">See you</a></b></p>
<xsl:template name="getJSCode">
function doThis(){alert('New this');}
function doThat(){alert('New that');}

Now it seems to me that I should get alerts with "New this" and "New that"
respectively but I'm wondering if the templates in an included stylesheet
have access to all the included stylesheets or only the ones it includes in

In a related question, what happens when the same stylesheet is included in
multiple places in an include chain. I've had it where my final stylesheet
depends on transforms from two other stylesheets, so it included both. As it
turns out, the third stylesheet was also dependant on the second. The import
tree looked something like

    +--C --B
(Man that looks crappy on my machine)

Everything worked fine but MSXML3SP1 seemed to be painfully slow. Eventually
I realized that C was unnecessary on its own so every was suddenly a lot
faster but I'm still curious about the effects on performance this should


Adam van den Hoven
Internet Software Developer
Blue Zone
tel. 604 685 4310 ext. 280
fax 604 685 4391

> Blue Zone makes you interactive. http://www.bluezone.net/

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

Current Thread