Re: [xsl] applying templates to all but ...

Subject: Re: [xsl] applying templates to all but ...
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Sat, 25 Sep 2004 21:08:30 -0400
This is slightly more complicated as I work on it ...

On Sep 24, 2004, at 11:53 AM, David Carlisle wrote:

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?

"all" or "any" ?


If you have [1] then only one will be used, the first one
for which their is a hit (using the fact that xslt2 sequences are
ordered, the order of strings in the sequence controls which you try first)
If you mean that you want _all_ of the first four to be applied if
elements with all those attributes are there then you'd need a different
syntax.

The logic is as follows:


All records have a class and a type. Class has to be deduced algorithmically, while type is based strictly on the value of mods:genre.

OK, so I have my variables that group types by class, like so:

<xsl:variable name="refclass-partInSerial"
     select="('article-newspaper','legal case','bill','article')"/>

.... and then, per David's (and Jeni's) suggestion, an apply-template like this:

<xsl:apply-templates select="$style-biblio/(for $t in $refclass-partInSerial
return cs:reftype[not(@inherit-from)][@name=$t])[1]/(cs:* except cs:creator)">
<xsl:with-param name="source" select="."/>
</xsl:apply-templates>


But, of course, this isn't quite right. What I need it to say is:

- if the mods:genre=some value, and that value has an equivalent style definition, then use it
- if not, then default to "article" (which is required)


Most of the time, it would be using he default.

So at it's most basic:

if mods:genre='legal case' and cs:reftype/@name='legal case' exists, use it, etc.

An additional complication is that the values of the mods:genre and cs:reftype/@name might not always quite line up.

Bruce

Current Thread