xsl-list
[Top] [All Lists]

Re: [xsl] Multi condition sum [Correction]

2008-12-12 05:30:23
2008/12/12 peter verhaar <peter(_dot_)verhaar1(_at_)gmail(_dot_)com>:
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[(_at_)name="quantity"])

but how to add the Status = "Available" condition???


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


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

--~------------------------------------------------------------------
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>
--~--

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