[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Do Templates Conflict?

Subject: Re: Do Templates Conflict?
From: Brian Chrisman <incubus@xxxxxxxxxxxxxx>
Date: Wed, 4 May 2005 13:31:20 -0700
brian chrisman
On Wed, May 04, 2005 at 03:03:29PM -0500, Edward Bryant wrote:
> 
> I was wondering if someone can explain why two templates that both apply to 
> a source xml element do not conflict.
> 
> I have one template that applies to all the paragraphs in a document and 
> another that applies only to the first paragraph. I did this assuming it 
> would somehow not work because of the conflict between the templates. 
> However, to my surprise it worked fine. Now, I am even more worried because 
> I don't know why it worked. Can someone explain what is going on?

Reason it probably worked as you expected is because you
probably had two templates like:
match="paragraph"
and
match="paragraph[position() = 1]"

There's a priority scheme for templates which is fairly well
documented in most places where you'd look up template matching
stuff.  Some of the pieces of information which I personally
found most useful:
a) stuff with [] predicates get higher priority 
b) using a '|' doesn't increase priority in and of itself

You can override this priority directly, but I've been burned
a few times in doing that.. generally if I have something which 
I very specifically want called, I'll use a call-template, or
perhaps a mode.

Normally, the calculated priority works well.. and I guess if
I kept the actual values related those calculations in mind
while programming, it might make using priorities more
effective.

Hope this helps.

> 
> Does the order the templates are listed in matter?
> 
> Does it matter that one selected a more specific context?

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.