[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Count a element in a specific section

Subject: Re: Count a element in a specific section
From: zun@xxxxxxxxxxxxxx
Date: Thu, 9 Sep 1999 11:21:40 -0400 (EWT)
stephane st denis
Hi Stephane, everyone,

On Thu, 9 Sep 1999, Stephane St-Denis wrote:

> I would like to know if it is possible to count a element
> in a specific section.
> 
> Example :
> <ie>
> <breakdown>
>  <ie>
>   <name>
>   <ie>
>    <name>
>   </ie>
>  </ie>
> </breakdown>
> </ie>

Your <name> tags should be <name/> right?

> XSL :
> <xsl:template match="*/ie/name">

*/ie/name won't work, but //ie/name will.

>  <div class="BodyText">
>   <xsl:value-of select="count(from-ancestors(IE in section
> Breakdown))"/>
>  </div>
> </xsl:template>
> 
> It is possible to have a statement to execute
> this : count(from-ancestors(IE in section Breakdown)).

Yes, count(ancestor::breakdown//ie) if you want 2 as your answer.  You
have to think in terms of node sets.

However it sounds like you're using IE's XSL, so you probably need
something like count(from-ancestors(breakdown)/ie), but I'm not familiar
with IE at all.

Questions like these are easy to answer by playing around in my XPathShow
tool that highlights nodes returned from an XPath expression.  Ironing out
the final bugs now, it should be released by the end of this week =)

. .  Sean.



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.