I have the following code (xml and xslt) and I would like to count some xml elements with 2 conditions.
XMLcode:
<home>
<place Value='place1'>
<property Name="Type" Value="house" />
<property Name="Context" Value="roof" />
<property Name="Color" Value="blue" />
</place>
<place Value='place2'>
<property Name="Type" Value="house" />
<property Name="Context" Value="kitchen" />
<property Name="Color" Value="red" />
</place>
<place Value='>
<property Name="Type" Value="house" />
<property Name="Context" Value="floor" />
<property Name="Color" Value="black" />
</place>
<place Value='place4'>
<property Name="Type" Value="house" />
<property Name="Context" Value="kitchen" />
<property Name="Color" Value="black" />
</place>
<place Value='place5'>
<property Name="Type" Value="apartment" />
<property Name="Context" Value="roof" />
<property Name="Color" Value="blue" />
</place>
<place Value='place6'>
<property Name="Type" Value="apartment" />
<property Name="Context" Value="kitchen" />
<property Name="Color" Value="red" />
</place>
</home>
xslt code:
<html>
<body>
<table border="1" cellspacing="0" cellpadding="3">
<tr>
<td>Place</td>
<td>Type</td>
<td>Context</td>
<td>Color</td>
</tr>
<xsl:for-each select="place">
<tr>
<td><xsl:value-of select="@Value" /></td>
<td><xsl:value-of select="property[@Name='Type']/@Value" /></td>
<td><xsl:value-of select="property[@Name='Context']/@Value" /></td>
<td><xsl:value-of select="property[@Name='Color']/@Value" /></td>
</tr>
</xsl:for-each>
</table>
<table>
<tr>
<td>
Number of house:
</td>
<td>
<xsl:value-of select="count(place/property[@Name='Type' and @Value='house'])"/>
</td>
</tr>
<tr>
<td>
Number of kitchen:
</td>
<td>
<xsl:value-of select="count(place/property[@Name='Context' and @Value='kitchen'])"/>
</td>
</tr>
<tr>
<td>
Number of house with kitchen:
</td>
<td>
<xsl:value-of select="count(place/property[@Name='Type' and @Value='house'][@Name='Context' and @Value='kitchen'])"/>
</td>
</tr>
</table>
</body>
</html>
The first two counts are working correctly (there is just one condition on these counts) but the third count does not work because there are two conditions. Any suggestion how to make it work? Thanks.