Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 21st, 2012, 04:57 AM
Authorized User
 
Join Date: Sep 2011
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default Comparing two values

Hi

I have this xsl code:

<table>
<tbody id="tbData">
<xsl:for-each select="//report/TierCalculation/row">
<tr>
<td height="25" nowrap="1">
<xsl:if test="position() mod 2 = 1">
<xsl:attribute name="class">TableCellLightSmlText</xsl:attribute>
</xsl:if>
<xsl:if test="position() mod 2 = 0">
<xsl:attribute name="class">TableCellWhiteSmlText</xsl:attribute>
</xsl:if>
<xsl:text disable-output-escaping="yes">&amp;pound;</xsl:text>
<xsl:value-of select="@TOTAL" />
</td>
</tr>
</tbody>
</table><br/>

<table>
<tbody id="tbData">
<xsl:for-each select="//report/DecisionTierOrMinPlatCharge/row">
<tr>
<td height="25" nowrap="1" id="tdDecisionAnnualMinCharge">
<xsl:if test="position() mod 2 = 1">
<xsl:attribute name="class">TableCellLightSmlText</xsl:attribute>
</xsl:if>
<xsl:if test="position() mod 2 = 0">
<xsl:attribute name="class">TableCellWhiteSmlText</xsl:attribute>
</xsl:if>
<xsl:value-of select="@AnnualMinCharge" />
</td>

So what I'm trying to do is to compare the value of @TOTAL and @AnnualMinCharge and get the highest on. I tried this code below but I don't get it right:

<td class="TableHeaderDarkSmlText" id="DecisionHigherAmountChosen">

<xsl:if test="(//report/TierCalculation/row/@TOTAL) > @AnnualMinCharge">
<xsl:value-of select="(report/TierCalculation/row/@TOTAL)"/>
</xsl:if>



</td>
</tr>
</tbody>
</table><br/>
 
Old December 21st, 2012, 05:49 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Your question isn't very good unfortunately. We have no idea what your XML looks like, and from a quick look your sample XSLT doesn't even look valid (you have two xsl:for-each instructions, but no closing tags for them).

Please read the 'hints for a good XSLT post' and then try again: Hints for a good XSLT post
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old December 21st, 2012, 06:03 AM
Authorized User
 
Join Date: Sep 2011
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I'm trying to do comparison here:

<xsl:if test="(//report/TierCalculation/row/@TOTAL) > (//report/DecisionTierOrMinPlatCharge/row/@AnnualMinCharge)">-->
<xsl:value-of select="(//report/TierCalculation/row/@TOTAL)"/>
</xsl:if>

But now they are strings so I think I need to convert them to numbers





Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing Two values from same table MArgente BOOK: Beginning SQL 3 December 11th, 2009 07:35 AM
Comparing values between different MSHFlexGrid davekrunal46 Visual Basic 2005 Basics 0 November 28th, 2005 07:42 AM
Comparing values between different MSHFlexGrid davekrunal46 VB How-To 0 November 28th, 2005 07:41 AM
Comparing values between different MSHFlexGrid davekrunal46 VB Databases Basics 0 November 28th, 2005 07:39 AM
Comparing values between different MSHFlexGrid davekrunal46 Beginning VB 6 0 November 28th, 2005 07:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.