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

Re: XSL count function.

Subject: Re: XSL count function.
From: Anthony <apwebdesign@xxxxxxxxx>
Date: Thu, 3 Mar 2005 16:01:46 -0800 (PST)
xsl count
@type = 'txt'



--- Gang Li <g_li@xxxxxxxxx> wrote:

> 
> Try
> 
> <xsl:value-of select="count(file[@type="txt"])"/> 
> 
> or
> 
> <xsl:value-of select="count(file[@type="'txt'"])"/> 
> 
> Your syntax is correct but I think it has something
> to do with string
> comparison here.
> 
> --- c p <bugs75il@xxxxxxxxx> wrote:
> > Hello,
> > 
> > I have a XML file (see below) with a "file" nodes
> and
> > I want to get a count of file nodes based on
> certain
> > attributes.  I am using XSLT transformations on
> the
> > XML to put them into HTML.
> > 
> > Here is the XML:
> >
> ---------------------------------------------------
> > <file type="txt" path="...."/>
> > <file type="txt" path="...."/>
> > <file type="doc" path="....."/>
> > <file type="html" path="...."/>
> >
> ---------------------------------------------------
> > 
> > End result I want displayed on the screen is
> something
> > like this:
> >
> ---------------------------------------------------
> > txt files: count = 2
> > doc files: count = 1
> > html files: count = 1
> > total files: count = 4
> > 
> > How would I get this?  I can get the total file
> count
> > by using: <xsl:value-of select="count(file)"/>.
> > 
> > To get the individual file counts I did something
> like
> > this: <xsl:value-of
> > select="count(file[@type='txt'])"/>  but it
> errored on
> > me.  
> > 
> > Any ideas?
> > 
> > Thanks,
> > C
> 
> 


=====
Anthony
ph: (408) 656-2473
blog: http://www.chovy.com

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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.