RE: [xsl] Importing stylesheet

Subject: RE: [xsl] Importing stylesheet
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 27 Jun 2001 09:45:29 +0100
> 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

A couple of typos here: xsl:with-param should be xsl:param and
select="innerHTML" should be select="$innerHTML".

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

Yes, the call-template in the imported stylesheet should select the template
with highest import precedence, which is the one in the importing
> In a related question, what happens when the same stylesheet
> is included in
> multiple places in an include chain.

It's exactly the same as if you included/imported two stylesheet modules
with the same content but different names: you get two copies of the same
thing. Which may be an error, especially with xsl:include, if it leads to
duplication of entries where duplicates aren't allowed, e.g. several global
variables with the same name at the same import precedence.

Mike Kay
Software AG

 XSL-List info and archive:

Current Thread