XSLT: Conflict Resolution for Template Rules

J

Joachim Spoerhase

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I am a XSLT-beginner and i read the XSLT-recommendation of the W3C through.
But I did'nt really understand section 5.5 of the latest specification. The
Problem is what template rule to be used if there are more than one
matching template rule.
You will find the following:

- ----------
....
5.5 Conflict Resolution for Template Rules
It is possible for a source node to match more than one template rule. The
template rule to be used is determined as follows:

1) First, all matching template rules that have lower import precedence than
the matching template rule or rules with the highest import precedence are
eliminated from consideration.

2) Next, all matching template rules that have lower priority than the
matching template rule or rules with the highest priority are eliminated
from consideration. ...
- ---------

Who is in the position to explain paragraph 1) and 2) to me? What is "the
matching template rule"?

Thank you in advance
Joachim Spoerhase

- -------------------------------
Joachim Spoerhase
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE/FUa59GC6tHzFSj0RAp9sAJoDvx9ujcfTHUWAUVblJXxBMuHcAgCfd/ny
31ie5Oxo2lcKDb+3kw7HF9I=
=2DjN
-----END PGP SIGNATURE-----
 
D

Dimitre Novatchev

Joachim Spoerhase said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I am a XSLT-beginner and i read the XSLT-recommendation of the W3C through.
But I did'nt really understand section 5.5 of the latest specification. The
Problem is what template rule to be used if there are more than one
matching template rule.
You will find the following:

- ----------
...
5.5 Conflict Resolution for Template Rules
It is possible for a source node to match more than one template rule. The
template rule to be used is determined as follows:

1) First, all matching template rules that have lower import precedence than
the matching template rule or rules with the highest import precedence are
eliminated from consideration.

2) Next, all matching template rules that have lower priority than the
matching template rule or rules with the highest priority are eliminated
from consideration. ...
- ---------

Who is in the position to explain paragraph 1) and 2) to me?

1) roughly means that all matching templates that are imported before a
given matching template are eliminated from consideration.

For example, if a stylesheet contains these two instructions:

<xsl:import href="a.xsl"/>
<xsl:import href="b.xsl"/>

then if b.xsl contains a matching template then all matching templates from
a.xsl are not considered, because they have lower import precedence
(priority).

2) roughly means that from the remaining matching templates (after 1) is
applied), the ones with priority, which is less than the maximum priority
among all such matching templates, are also eliminated from consideration.

So, if in the same stylesheet we have two matching templates, one with
priority="2" and the other with priority="6", then the first one is
eliminated from consideration, because it has a lower priority specified by
the XSLT programmer.
What is "the
matching template rule"?

It is said clearly -- the one or ones with the highest priority.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top