[xsl] Re: Counting only some children of a node - nevermind!

Subject: [xsl] Re: Counting only some children of a node - nevermind!
From: Christian Cäsar <caesar@xxxxxxxxxxxx>
Date: Thu, 23 Aug 2001 13:03:24 +0200
Hello list,

now I've found it. :-p

I used

count(descendant::Neutral)

Almost too easy...

Greetings,

Christian Caesar

Christian Cäsar schrieb:
> 
> Hello list,
> 
> consider this XML source:
> 
> <somenode>
>  <Tabelle>
>   <Spalte>
>     <Text>
>       <Neutral>sometext</Neutral>
>     </Text>
>   </Spalte>
>   <Spalte>
>     <Text>
>       <Neutral>sometext</Neutral>
>     </Text>
>   </Spalte>
>   <Spalte>
>     <Text/>
>   </Spalte>
>  </Tabelle>
> </somenode>
> 
> Some 'Text' Elements may have a child and values, others don't. I want
> to count the number of 'Spalte' Elements that have 'Text' elements with
> a child. The actual XML has more 'Spalte' elements.
> 
> I tried
> 
>   count(descendant::Tabelle/Spalte[/Text/*]) and
>   count(descendant::Tabellenheader/Spalte[/Text/text()])
> 
> but that was (obviously) wrong (I got 0), as is
> 
>   count(descendant::Tabelle/Spalte)
> 
> that got me (number of 'Spalte' Elements). I know I must be
> quite close to the solution, but I seem not to be able to see it.
> 
> If it is important: I am using Xalan.
> 
> Greetings,
> 
> Christian Caesar

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread