This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Importing stylesheet


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:stylesheet>
<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>
<xsl:template name="getJSCode">
<script>
<xsl:text>
function doThis(){alert('Default this');}
function doThat(){alert('Defualt that');}
</xsl:text>
</script>
</xsl:template>
</xsl:stylesheet>

I have another (many others) stylesheet that imports this one it looks
something like:
<xsl:stylesheet>
<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:with-param>
 </xsl:call-template>
</xsl:template>
<xsl:template name="getJSCode">
<script>
<xsl:text>
function doThis(){alert('New this');}
function doThat(){alert('New that');}
</xsl:text>
</script>
</xsl:template>
</xsl:stylesheet>

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

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

    +--B
A--|
    +--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
have..

Thanks!!!

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]