xsl-list
[Top] [All Lists]

[xsl] <xsl:apply-imports> and rules with higher priority; And more!

2008-06-04 08:41:24
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

The XSLT 2.0 Programmers Reference says, that <xsl:apply-imports> calls
the next template rule with lower stylesheet level (is that the same
like stylesheet layer?) matching the same node as the current template.
Furthermore it does NOT call template rules with lower priority in
imported stylesheets. What is about rules with higher priority in an
imported stylesheet with lower import precedence?

In addition: Does <apply-imports> relate to (one of) all stylesheets
with lower import precedence or only to the ones imported by the current
~ stylesheet (or stylesheet layer)? I know this works:

A import C
A include B
=> (import precedences: A = 2, B = 2, C = 1) B and A are on the same
layer, so <apply-imports> in A or B can involve C.

But does this work to?:

A import C
A import B
=> (import precedences: A = 3, B = 2, C = 1) B has higher import
precedence than C. Does that mean <apply-imports> in B can call a
template rule in C?

Last but not least: I'd like to call <apply-imports> and if there was
another rule with higher priority, but a lower import precedence I'd
like to return the result of it, else it should return the result of
this template. But I don't know how to access the information if there
was another matching rule.

I like to change the rule that import precedence decides which rule
matches before rule priority like this:

Stylesheet B.xsl & C.xsl:
<xsl:template match="test" priority="1 (: for B, 2 for C :)">
        <xsl:choose>
                <xsl:when test="there is another template rule for 
apply-imports with
higher priority">
                        <xsl:apply-imports/>
                </xsl:when>
                <xsl:otherwise>
                        <!-- sequence constructor for B or C respectively -->
                </xsl:otherwise>
        </xsl:choose>
</xsl:template>

Stylesheet A.xsl:
<xsl:import href="C.xsl"/>
<xsl:import href="B.xsl"/>

<xsl:template match="/" >
        <apply-templates/>
</xsl:template>

wfg,
Jonny.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIRreKGaEJacf6i/cRAk3GAJwMzrLBjQyByBqd3wVCL6qGeG3dzgCeMEQK
7NRuOtmAJH0WH2UKxv43Zkc=
=mb58
-----END PGP SIGNATURE-----

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