This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Choose-When-Otherwise Nesting Problem


Could you give some indication of the structure of your source document?

Also, I can't see any difference between the processing for odd-numbered and
even-numbered rows, have I missed something?

Mike Kay


> At the moment, we're trying to become familiar with how to
> nest XSL commands. In
> the example I've attached below, we want to take an incoming
> stream of XML and
> display text depending upon what the incoming MaxAmount and
> MinAmount values
> are. If a particular alert is associated with a MaxAmount or
> a MinAmount, we
> want to display it. If both MaxAmount and MinAmount are null,
> we want to display
> "Any Change". This process is repeated for all the incoming
> alerts with the
> output format being altered (by the outermost choose
> condition) to display
> alternating background colors in the output list.
>
> When we actually try this, the very first MaxAmount or
> MinAmount is displayed.
> But if the first value is a MaxAmount (for example), no
> subsequent MinAmounts
> will appear. By the same token, if the first value is a
> MinAmount, no MaxAmounts
> will appear. And even if all of the MaxAmount and MinAmount
> input is null, the
> choose statement will never make it down to the otherwise
> branch that should
> display "Any Change".
>
> We must be nesting these commands in the wrong order, causing
> the process to
> 'stick' on the first MaxAmount or MinAmount. But we don't see
> a clear solution.
>
> Any help would be appreciated.
>
> Thanks!
>
> Scott
> ==============================================================
> ==========
> <table>
> <xsl:for-each
> select="transaction/alertDefinitionGroup/alertDefinition">
>   <xsl:choose>
>     <xsl:when test="position() mod 2> 0">
>       <TR>
>         <TD>
>           <xsl:choose>
>             <xsl:when test="MaxAmount!='null'">
>               &gt; $<xsl:value-of select="MaxAmount" />
>             </xsl:when>
>             <xsl:when test="MinAmount!='null'">
>               &lt; $<xsl:value-of select="MinAmount" />
>             </xsl:when>
>             <xsl:otherwise>Any Change</xsl:otherwise>
>           </xsl:choose>
>         </TD>
>       </TR>
>     </xsl:when>
>     <xsl:otherwise>
>       <TR>
>         <TD>
>           <xsl:choose>
>             <xsl:when test="MaxAmount!='null'">
>               &gt; $<xsl:value-of select="MaxAmount" />
>             </xsl:when>
>             <xsl:when test="MinAmount!='null'">
>               &lt; $<xsl:value-of select="MinAmount" />
>             </xsl:when>
>             <xsl:otherwise>Any Change</xsl:otherwise>
>           </xsl:choose>
>         </TD>
>       </TR>
>     </xsl:otherwise>
>   </xsl:choose>
> </xsl:for-each>
> </table>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]