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

Re: Multi condition sum [Correction]

Subject: Re: Multi condition sum [Correction]
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Fri, 12 Dec 2008 10:30:02 +0000
Re:  Multi condition sum [Correction]
2008/12/12 peter verhaar <peter.verhaar1@xxxxxxxxx>:
> Hello,
>
> Sorry my last message was send to early.
>
> I have one question. assume this snippet:
>
> <books>
>  <book>
>   <column name="quantity">50</column>
>   <column name="status">available</column>
>  </book>
>  <book>
>   <column name="quantity">10</column>
>   <column name="status">available</column>
>  </book>
>  <book>
>   <column name="quantity">3</column>
>   <column name="status">lost</column>
>  </book>
> </books>
>
>
> Now I want to add all Quantity IF Status = "Available".
>
> All sum is this: sum(books/book[@name="quantity"])
>
> but how to add the Status = "Available" condition???


sum(/books/book[column[@name = 'status'] = 'available']/column[@name =
'quantity'])


cheers
-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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.