xsl-list
[Top] [All Lists]

Re: applying templates to all but ...

2004-09-24 08:42:28

On Sep 24, 2004, at 9:59 AM, David Carlisle wrote:

Except the [1] you put near the end is saying to use the first in the
list; right?

yes or no (depending on what you mean) It doesn't take the first in
_that_ list there would be no point in doing ('article-newspaper','article')[1]
as that's just a long way of writing 'article-newspaper' it takes teh
first element in the sequence of cs:reftype nodes obtained by selecting
the cs:reftypes  with name attribute equal to an item in the list.

So if I have five in the list, and I want all of the first four that are present in the config file to be applied first, and the last (article) only, well, last (because it is the fallback)? I use the same syntax?

Actually, the optional types only get applied from this template if they do not contain an "inherit-from" attribute. Does that change how you'd code it? Here's what you had:

<xsl:apply-templates
select="$style-biblio/(for $t in ('article-newspaper','article')
                return cs:reftype[(_at_)name=$t])[1]/cs:*">

... in practice you'd want to put the list into a variable or pull it
from a config file or something.

..... and what would, say, the variable actually look like?

Bruce



<Prev in Thread] Current Thread [Next in Thread>