Altova Mailing List Archives

Calculations inside XPath expressions?

From: Christofer Dutz <dutz@------.-->
Date: 4/10/2005 2:08:00 PM

I just ran into an interesting situation, where I was not able to write 
an xpath expression doing what I want it to. Mabe someone here can help 
me ... I hope ;)

Here a sample xml-file I want to do the query on:
<?xml version="1.0" encoding="UTF-8"?>
	<product count="2" price="10.00" id="sdkjfhdaf-A"/>
	<product count="1" price="10.00" id="sdkjfhdaf-A"/>
	<product count="1" price="30.00" id="sdkjfhdaf-B"/>
	<product count="4" price="12.50" id="sdkjfhdaf-C"/>
	<product count="2" price="16.00" id="sdkjfhdaf-A"/>
	<product count="3" price="119.00" id="sdkjfhdaf-C"/>
	<product count="2" price="13.99" id="sdkjfhdaf-A"/>
	<product count="10" price="12.34" id="sdkjfhdaf-B"/>
	<product count="3" price="11.00" id="sdkjfhdaf-B"/>
	<product count="1" price="1.00" id="sdkjfhdaf-A"/>

I would like to test, if the total price for all products in the cart 
which have an Id containing "-C" in their id-attribute is biger than 
lets say 100.
I have no problem selecting either the price or count attribute of these 
but I am unable to get "price * count".
Any suggestions?

I created a workaround by adding an additional total-attribute and 
everything is working fine, it's just my scientiffic curiosity ;)



These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.