xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: Conditionally showing a record


Subject: Re: Conditionally showing a record
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 7 Apr 2000 10:29:57 +0100 (BST)

> 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



Current Thread
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor