xsl:apply-imports?

Subject: xsl:apply-imports?
From: Tyler Baker <tyler@xxxxxxxxxxx>
Date: Mon, 21 Dec 1998 16:34:17 -0500
In the latest XSL spec the following is defined:

"xsl:apply-imports processes the current node using only template rules
that were imported into the stylesheet containing the current rule; the
node is processed in the current rule's mode."

What happens when you nest apply-imports statements inside of each
other, e.g.

<xsl:template match="foo">
  <xsl:apply-imports>
    <xsl:apply-templates/>
    <xsl:apply-imports>
       <xsl:apply-templates/>
          <xsl:apply-imports>
             <xsl:apply-templates/>
             OK now what is the stylesheet context?
          </xsl:apply-imports>
      </xsl:apply-imports>
  </xsl:apply-imports>
</xsl:template>

It looks as an XSL implementation will need to have each template
element maintain a pointer to the stylesheet that it is a member of in
order to determine what stylesheet the current rule refers to.  This is
of course easily doable in the implementation I have, but for
implementations which pass in a DOM Document as the stylesheet tree
(e.g. Koala) this would force the XSL implementor to have a global table
mapping templates to the stylesheet that owns them.

The other thing I am not so sure about is the scope of
xsl:apply-imports.  In the example above, should scope be inherited from
any ancestor xsl:apply-import elements of a particular template node or
should a nested use of xsl:apply-imports override any ancestor
xsl:apply-import elements.

Regards,

Tyler


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


Current Thread