xsl-list
[Top] [All Lists]

Re: Grouping and counting values in an element

2004-08-16 13:23:06

Dear Wendell,

Thanks for your reply, but sorry, cause I am still a newbie.
How do you concatenate all the Payment_Pattern that comes back ?
Can you show me an example please ? thx

Cezar

From: Wendell Piez <wapiez(_at_)mulberrytech(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Grouping and counting values in an element
Date: Mon, 16 Aug 2004 15:32:41 -0400
MIME-Version: 1.0
X-Sender: wapiez(_at_)earthlink(_dot_)net
Received: from h01.biglist.com ([209.123.46.101]) by mc3-f3.hotmail.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 16 Aug 2004 12:46:12 -0700
Received: (qmail 95104 invoked by uid 2149); 16 Aug 2004 19:46:01 -0000
Received: (qmail 95089 invoked from network); 16 Aug 2004 19:46:01 -0000
X-Message-Info: JGTYoYF78jEqtIvqinRlMZ9R2A+A9jmN
Mailing-List: contact xsl-list-help(_at_)lists(_dot_)mulberrytech(_dot_)com
Precedence: bulk
X-BL-Legal-Notice: <http://www.BIGLIST.com/legal/>
X-Complaints-To: <mailto:abuse(_at_)BIGLIST(_dot_)com>
List-Post: <mailto:xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
List-Help: <mailto:xsl-list-help(_at_)lists(_dot_)mulberrytech(_dot_)com>
List-Unsubscribe: <mailto:xsl-list-unsubscribe-excel_man=hotmail(_dot_)com(_at_)lists(_dot_)mulberrytech(_dot_)com>
List-Subscribe: 
<mailto:xsl-list-subscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
Delivered-To: mailing list xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Message-Id: 
<6(_dot_)0(_dot_)0(_dot_)22(_dot_)0(_dot_)20040816152829(_dot_)02d98178(_at_)earthlink(_dot_)net>
X-Mailer: QUALCOMM Windows Eudora Version 6.0.0.22
In-Reply-To: <BAY9-F19839xjQ0BwSN0002f1cd(_at_)hotmail(_dot_)com>
References: <BAY9-F19839xjQ0BwSN0002f1cd(_at_)hotmail(_dot_)com>
Return-Path: xsl-list-return-4708-excel_man=hotmail(_dot_)com(_at_)lists(_dot_)mulberrytech(_dot_)com X-OriginalArrivalTime: 16 Aug 2004 19:46:13.0125 (UTC) FILETIME=[AF9E0350:01C483C9]

Hi Cezar,

Given a Payment_Pattern as the current node,

<xsl:value-of select="string-length(.) - string-length(translate(.,'2','')"/>

would tell you how many occurrences of '2' are in the string. (Subtract the length of the string with the 2s removed from the length of the full string.)

If by "in all the records" you mean all the Payment_Pattern elements together, they could be concatenated and the same operation performed on the resulting mega-string.

Cheers,
Wendell

At 03:35 PM 8/16/2004, you wrote:
Dear all,

I got a problem.
<Trades>
 <record>
 <Payment_Pattern>111111111111111</Payment_Pattern>
 </record>
 <record>
 <Payment_Pattern>112224443311111</Payment_Pattern>
 </record>
 <record>
 <Payment_Pattern>1112211111133311</Payment_Pattern>
 </record>
</trades>

The question is how do you get the number of 2's (or 1's or 3's) in all the records ?
Any help will be appreciated, thx

Cezar

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



<Prev in Thread] Current Thread [Next in Thread>