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

RE: conditional count

Subject: RE: conditional count
From: "Daniel Heskia" <daniel@xxxxxxxxx>
Date: Wed, 20 Oct 2004 12:37:01 +0200
conditional count
Thanks Ken and Mukul.

I only tried the first solution and the idea worked out fine.
Actually I realized that I needed to filter all empty elements and elements
containing one or more empty elements or one or more 0-value elements.

I therefore used not(/root/row[column[.=0]) and
not(/root/row[column[normalize-space(.)=''])

Thanks for the fast reply guys!

Sincerely
Daniel

-----Original Message-----
From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx] 
Sent: 19. oktober 2004 19:01
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  conditional count


At 2004-10-19 18:07 +0200, Daniel Heskia wrote:
>I can filter out the empty "row"'s by challenging the contents of the 
>entire element by: <xsl:value-of 
>select="count(/root/row[normalize-space()])"/>
>
>But how do I exclude an element "row" if just a single "column" in the 
>element is empty?

For "exclude those with at least one empty column":

    count(/root/row[not(column[not(normalize-space())])])
    "count rows without columns without space"

For "exclude those with exactly one empty column":

    count(/root/row[not(count(column[not(normalize-space())]=1))])
    "count rows without a single column without space"

I hope this helps.

.......................... Ken

><root>
><row>
>   <column>Peter</column>
>   <column>Johnson</column>
>   <column>High Street 10</column>
>   <column>Male</column>
>   <column>15-10-2004</column>
>   <column>13.11</column>
>   </row>
><row>
>   <column></column>
>   <column></column>
>   <column></column>
>   <column></column>
>   <column></column>
>   <column></column>
>   </row>
><row>
>   <column>Sue</column>
>   <column>Bond</column>
>   <column>Dollar Avenue</column>
>   <column>Female</column>
>   <column>01-05-2003</column>
>   <column></column>
></row>
></root>


--
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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.