This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Conditionally showing a record
> I want to only show the Records when the element Line is evenly
> divisiable by 10.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
>
<xsl:output method="html" indent="yes"/>
<xsl:template match="Example">
<table>
<xsl:for-each select="Record/Order[Line mod 10 = 0]">
<tr>
<td><xsl:value-of select="Line"/></td>
<td><xsl:value-of select="Item"/></td>
<td><xsl:value-of select="Price"/></td>
</tr>
</xsl:for-each>
<tr>
<td>Total</td>
<td/>
<td><xsl:value-of select="sum(Record/Order[Line mod 10 = 0]/Price)"/></td>
</tr>
<tr>
<td>Other Total</td>
<td/>
<td><xsl:value-of select="sum(Record/Order[Line mod 10 != 0]/Price)"/></td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
<table>
<tr>
<td>10</td><td>100</td><td>10.00</td>
</tr>
<tr>
<td>20</td><td>300</td><td>30.00</td>
</tr>
<tr>
<td>Total</td><td></td><td>40</td>
</tr>
<tr>
<td>Other Total</td><td></td><td>60</td>
</tr>
</table>
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list