[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Count a element in a specific section
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|