Re: [xsl] XSL counting node by inheritable attribute

Subject: Re: [xsl] XSL counting node by inheritable attribute
From: paavali muurahainen <paavalimuurahainen@xxxxxxxxx>
Date: Fri, 19 Nov 2010 13:00:05 +0800
Hi,

2010/11/17 Michael Kay <mike@xxxxxxxxxxxx>:
> You can use (ancestor-or-self::*/@type)[last()] to access the innermost
> attribute named @type on this element or a containing element.

Thanks! In my case this turned out to

<xsl:value-of select="count(//level1[@feature=$current_feature]/level2/level3[(ancestor-or-self::*/@type)[last()])=$current_type])"/>

where $current_feature and $current_type are the variables from the
loops mentioned earlier. I had some trouble putting the query given by
you together with comparison of the value although now that I did it,
it seems very obvious. Live and learn.

BR,
Paavali

Current Thread