Re: [xsl] counting problem

Subject: Re: [xsl] counting problem
From: Bryan Schnabel <bryan.schnabel@xxxxxxxxxxxxx>
Date: Thu, 13 Jun 2002 13:02:21 -0700 (PDT)
> So if I have something like this:
> <S>
>   <R>
>     <A/> *
>     <A/> *
>     <S>
>       <R><A/> * </R>
>       <R><A/></R>
>     </S>
>   </R>
>   <R>
>     <A>
>   <R>
> </S>
> 
> It should count 3 A's, the ones I marked.
> 
> Is there a way to do that in xpath alone?

When you say XPath alone, do you mean without
recursion?

Are you looking for something like this:


<xsl:template match="/">
 <xsl:text>My whole document has </xsl:text>
 <xsl:value-of select="count(//S/R[1]/A)" />
 <xsl:text> A's that are the child of an S's first
R</xsl:text>
</xsl:template>

If so, just beware of the '//'


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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


Current Thread