Re: Attributes, modes and templates [solution]

Subject: Re: Attributes, modes and templates [solution]
From: Alex Lancaster <alex@xxxxxxxxxxx>
Date: 13 May 2000 18:03:51 -0600
>>>>> "TG" == Tony Graham <tgraham@xxxxxxxxxxxxxxxx> writes:

TG> At 13 May 2000 02:55 -0600, Alex Lancaster wrote:

>> Search for the all the desired nodes `corpauthor', `fax', `author'
>> in the following example that have as _ancestors_ (arbitrarily
>> deep), a `variablelist' with the appropriate attribute set, so I
>> have templates like the following:
>> 
>> <!-- rules for role subclassing on programmer info pages -->
>> <xsl:template
>> match="variablelist[@role='programmers']//corpauthor">

TG> What about:

TG> <xsl:template 
TG>    match="corpauthor[ancestor::variablelist[@role='programmers']]">

Also sounds fine to me.  My solution definitely works, so the real
question is: what are the relative advantages/disadvantages between
these solutions?  i.e. is it going to be relatively more efficient to
process in the second way versus the first, or do the XPath
expressions (which are effectively equivalent as far as I can tell)
get "mapped" to the same underlying implementation?

Modulo the efficiency issues (which I have no expertise on), the
relative advantages I can see are:

The advantage to Tony's way is that the element in question comes
first in the template, it says "give me all the corpauthor elements
with an ancestor of variablelist with the attribute set to so-and-so",
so it's more readable and self-documenting than my solution.

The advantage to my way is that it's a shorter XPath expression.

Thanks for the suggestion!

Alex
-- 
Alex Lancaster * alex@xxxxxxxxxxx * www.santafe.edu/~alex * 505 984-8800 x242
Santa Fe Institute (www.santafe.edu) & Swarm Development Group (www.swarm.org)


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread