Subject: [xsl] <xsl:apply-imports> and rules with higher priority; And more! From: Johannes Neubauer <johannes.neubauer@xxxxxxxxxxxxxxxxx> Date: Wed, 04 Jun 2008 17:40:58 +0200 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
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.
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-----
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] why: first mode, then mat, David Carlisle | Thread | Re: [xsl] <xsl:apply-imports> and r, David Carlisle |
RE: [xsl] Debug/QC Stylesheets, Michael Kay | Date | Re: [xsl] Debug/QC Stylesheets, Nic Gibson |
Month |