I have an xml and I want to count the price of all properties who have the type of apartment and average them. How do i go about doing that? I have tried using my way but it isn't working. As for the total properties with cheap rental price, how do i calculate it so that I can get the sum of all prices less than 400.
<p>Total number of properties : <xsl:value-of select="count(property/type[normalize-space(text())='apartment'])"/></p>
<p>Average price : <xsl:value-of select="count(property/type[normalize-space(text())='apartment']/price)"/></p>
<p>Total properties with cheap rental price : </p>
<rentalProperties>
<property contact="0499584010">
<type>house</type>
<price>430</price>
<address>
<streetNo>111</streetNo>
<street>say, Burwood Road</street>
<suburb>say, Hawthorn</suburb>
<state>VIC</state>
<zipcode>3122</zipcode>
</address>
<numberOfBedrooms>3</numberOfBedrooms>
<numberOfBathrooms>1</numberOfBathrooms>
<garage>1</garage>
<description></description>
</property>
</rentalProperties>