I have the following variable which I use to calculate a sum of revenue for a customer.
<xsl:variable name="revenue">
<xsl:value-of select="format-number(sum(//fn:array[@key= 'Items']/fn:map/fn:map[@key ='Amount']/*[@key = 'Net']),'##.##')" />
</xsl:variable>
I would like to filter based on Type, as you can see from the JSON object below:
"Items":[
{
"Id":"5eab80a9-7d1c-4dc3-a6df-aca4015519b2",
"CustomerId":"0db08884-3218-4c38-b895-aca4014fa598",
"OrderId":"7965b5fc-fb21-472e-a862-aca401551900",
"ServiceId":"bd26d8db-86da-4f96-9efc-e5a4654a4a94",
"ProductId":null,
"BillId":"2f5009f7-b1d8-4138-a2ac-aca60099a6ca",
"InvoiceId":null,
"AccountingCategoryId":"0cf7aa90-736f-43e9-a7dc-787704548d86",
"CreditCardId":null,
"Type":"ServiceRevenue",
"SubType":"SpaceOrder",
"Name":"Night 02/01/2021",
"Notes":null,
"ConsumptionUtc":"2021-01-02T14:00:00Z",
"ClosedUtc":"2021-01-04T09:19:46Z",
"State":"Closed",
"SubState":null,
"Amount":{
"Value":100.00,
"Net":95.24,
"Tax":4.76,
"TaxRate":0.05,
"Currency":"GBP",
"NetValue":95.24,
"GrossValue":100.00,
"TaxValues":[
{
"Code":"UK-2020-R",
"Value":4.76
}
]
}
},
I tried the following but does't work:
<xsl:value-of select="format-number(sum(//fn:array[@key= 'Items']/fn:map/fn:map[@key ='ServiceType']='ServiceRevenue'/fn:map[@key ='Amount']/*[@key = 'Net']),'##.##')" />
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…