At 2009-09-10 18:27 -0700, Bill French wrote:
xsl:import is pretty awesome, let me say that right off.
I totally agree. Here is a paper describing the publishing system I
designed and implemented for publishing individual US intelligence
documents according to a common XSD using different skins for every
intelligence gathering agency (e.g. CENTCOM, STRATCOM, US Forces
South Korea, US Coast Guard, etc.) that heavily relies on xsl:import:
http://www.CraneSoftwrights.com/links/ipepaper.htm
Note that the XSLStyle documentation methodology is very helpful in
documenting a multi-import/include stylesheet including an
alphabetized index of top-level named constructs and in which module
each construct is found:
http://www.CraneSoftwrights.com/resources/#xslstyle
But it sometimes yields surprising results.
I've found it very reliable when using Saxon. I've found it very
unreliable using Xalan and other XSLT processors (but of course I've
not tried them all).
I have a stylesheet called rendereddocument.xsl that imports a
number of other stylesheets using the xsl:import instructions:
<xsl:import href="inc/baseline.xsl"/>
<xsl:import href="inc/application-tabs.xsl"/>
<xsl:import href="inc/fields.xsl"/>
<xsl:import href="inc/search-criteria.xsl"/>
<xsl:import href="inc/search-fields.xsl"/>
<xsl:include href="../../override/xslt/customization.xsl"/>
in fields.xsl, I have a template defined as follows:
<xsl:template match="rm:document">
...
and in rendereddocument.xsl I have two templates that are defined as follows:
<xsl:template match="rm:document" priority="-0.1">
...
<xsl:template match="rm:associated" priority="-0.1">
...
<xsl:apply-imports/>
...
In the last template, there's an xsl:imports instruction. The
element on which this template is matching, rm:associated, has
rm:document children. It's my understanding that xsl:apply-imports
should elect to apply the xsl:template defined in fields.xsl, not in
rendereddocument.xsl.
Not quite, but very close.
However, this isn't what's happening. Instead, the template matching
rm:document defined in rendereddocument.xsl is being applied.
Probably because of the way that rm:associated is being handled by
the imported stylesheets.
<xsl:imports> *re-applies* the last-matched node using only the
imported stylesheets ... so it is as if you wrote
<xsl:apply-templates select="."/> with imported stylesheets, it isn't
(as I think you've written above) an <xsl:apply-templates
select="node()"/> or <xsl:apply-templates/> with imported stylesheets.
So, to figure out what is happening in your situation, check out how
you are handling rm:associated in the imported stylesheets, and that
will probably tell you how rm:document is being pushed at your stylesheet.
Any help would be most appreciated. Let me know if you need to see
all the files. Last time, the issue was glaringly apparent from just
the first email. ;)
Hopefully you've found this just as helpful.
. . . . . . . . . . . Ken
--
Interested in these classes? http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--