tenalibabu
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by tenalibabu
-
-
I get an error that says "too many items". Isn't concat really used to concatenate 2 or more strings?Example: concat('XPath ','is ','FUN!')Result: 'XPath is FUN!'Also, how will this group the records by dateIncurred?how about:concat(distinct-values(/expenseReport/items/item/dateIncurred),' ',sum(/expenseReport/items/item/amount))
-
Hello,I have the following XML document.
<?xml version="1.0" encoding="UTF-8"?><expenseReport> <items> <item> <dateIncurred>2006-10-23</dateIncurred> <category>meals</category> <amount>7.99</amount> </item> <item> <dateIncurred>2006-10-23</dateIncurred> <category>meals</category> <amount>6.50</amount> </item> <item> <dateIncurred>2006-10-24</dateIncurred> <category>meals</category> <amount>7.50</amount> </item> <item> <dateIncurred>2006-10-24</dateIncurred> <category>meals</category> <amount>19.50</amount> </item> <item> <dateIncurred>2006-10-25</dateIncurred> <category>one-time parking</category> <amount>15.00</amount> </item> </items></expenseReport>
I need to write an xpath that will give me the sum of all <amount> fields grouped by date.Something like this:2006-10-23 14.492006-10-24 27.002006-10-25 15.00or simply this14.4927.0015.00Any ideas?The following xpath query...
distinct-values(/expenseReport/items/item/dateIncurred)
returns:2006-10-23 2006-10-24 2006-10-25 I need to combine the above query with the sum function but I'm not sure how.
XPath: Group by and Sum functions
in XML
Posted
You are right on. You understood me well. The XSLT you have there will work perfectly but unfortunately I have to do this with Xpath 2.0. I am using this within the BizTalk Rules Engine. Which means a single xpath statement should handle the grouping and summation. It almost seems impossible but I have not given up yet.