xsl-list
[Top] [All Lists]

RE: RE: Setting values for variable

2004-09-10 04:49:38
Sorry for the intrusion, but i want to say i agree with that. When i start
XSLTiing (4 months ago) i've done that variables / for-each errors, but when
one change the "way of thinking" the solution comes very often in a "natural"
way...

Well, of course this great list helps *a lot*...


Quoting cknell(_at_)onebox(_dot_)com:


I have often found that the <xsl:for-each> is used by people new to XSLT
(this was true of me when I first started) in situations where
<xsl:apply-templates> is more appropriate simply because the for-each-next
loop is such a familiar programming construct.


--
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     john lee <excel_man(_at_)hotmail(_dot_)com>
Sent:     Thu, 09 Sep 2004 22:42:06 +0000
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  RE: [xsl] Setting values for variable


It's not working.
First of all, if you do it like that, it will generate error, since pterm1
is out of scope (pterm1 is inside for-each and inside a when)
Secondly, If I place the declaration of pterm1 outside the for-each, as
follow:
<xsl:variable name="pterm" select="0"/>
<xsl:variable name="pterm1">
<xsl:for-each select="$lstAccount[Account_Type=$grpRecord]">
<xsl:choose>
<xsl:when test="string-length(normalize-space(Payment))!=0">
<xsl:value-of select="$pterm + Payment"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$pterm + 0.02*Balance"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="$pterm1"/>

The calculation is not correct.
Any other ideas out there ?

Thanks

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--









O SAPO já está livre de vírus com a Panda Software, fique você também!
Clique em: http://antivirus.sapo.pt