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

Subject: Re: [xsl] applying templates to all but ...
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 24 Sep 2004 16:53:37 +0100
> 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.


> 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[@name=$t])[1]/cs:*">

I don't carry a picture of your input in mmy head so I have trouble
mapping the english "optional types" to any part of that expression but
perhaps

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


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

A long time since I did any electronics but some kind of electron state
change in some silicon somewhere.

I just meant replace ('article-newspaper','article') by $foo

and have 
<xsl:variable name="foo" select="('article-newspaper','article')"/>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread