[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Template doesn't seem to match


Subject: Re: [xsl] Template doesn't seem to match
From: Markus Abt <abt@xxxxxxxx>
Date: Tue, 10 Jul 2012 12:53:24 +0200

russurquhart1@xxxxxxxxxxx wrote:
> that actually seems to have worked!!
> 
> But i thought that an xpath like SubSection[*[@filter='filter1']] is read as, 
> a SubSection element that contains any children having a filter attribute 
> equal to 'filter1'.

Yes, exactly.

But that's not what you want. What you want is to match a SubSection 
element that contains any _descendant_ having a filter attribute equal 
to 'filter1'. A grandchild is not a child.

In my recent example, the leftmost SubSection does not have a child 
with @filter="filter1", but it has a grandchild (or more general, a 
descendant) with @filter="filter1":

SubSection/SubSection/SubSection[@filter='filter1']

Markus


Current Thread
Keywords