xsl-list
[Top] [All Lists]

Re: Lookup Table?

2004-08-17 14:41:23
Yes, it looks like you'll need to enumerate the valid account values,
either in a lookup table, or if your values are limited you could use
something like:

<xsl:variable name="open-account-ids" 
    select="':01:02:03:04:05:06:07:08:09:B:AC:'"/>
<xsl:value-of select="count(//MOP[contains($open-account-ids,
concat(':', ., ':'))])"/>

If you think you might get a : in your MOP value, then pick a
delimiter that won't...

As for your sum problem, assuming you can just skip the non-number
values, try this:

<xsl:value-of
    select="sum($lstAccount[Account_Name=$grpRecord2]/Payment[number(.)
&gt; 0])" />

Josh

On Tue, 17 Aug 2004 19:37:12 +0000, john lee <excel_man(_at_)hotmail(_dot_)com> 
wrote:
Thank you all for the previous answers.
I just got extra documentation where there are some cases where the code
indicator for opened account could be a char ('B', 'AC'). In this case,
should I use a lookup table ?

Are there any other good lookup table sample I can refer to ?

My other question is:
If you use the number function, and if there are a couple of result that
comes back 'UNKNOWN' instead of a number, it will cast a NaN right ? and if
you do sum($total), it will give you NaN again.
How do you avoid this ?

This is my code to get the total:
<xsl:key name="keyAccount" match="Trades/Record" use="Account_Type" />

<xsl:for-each select="$lstAccount[generate-id(.) =
generate-id(key('keyName', Account_Name))]">
 <xsl:variable name="grpRecord2" select="Account_Name"/>
 <tr>
  <td colspan="4">
   <xsl:value-of
select="$lstAccount[Account_Name=$grpRecord2]/Account_Name" />
  </td>
  <td colspan="1" class="RightJustified">
   <!-- Show the total High for the current Employee -->
   <xsl:value-of
select="sum($lstAccount[Account_Name=$grpRecord2]/Payment)" />
  </td>
 </tr>
</xsl:for-each>

Any help would be appreciated,

Cezar

From: Wendell Piez <wapiez(_at_)mulberrytech(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Lookup Table?
Date: Tue, 17 Aug 2004 12:30:30 -0400
MIME-Version: 1.0
X-Sender: wapiez(_at_)earthlink(_dot_)net
Received: from h01.biglist.com ([209.123.46.101]) by mc1-f24.hotmail.com
with Microsoft SMTPSVC(5.0.2195.6824); Tue, 17 Aug 2004 10:28:06 -0700
Received: (qmail 67309 invoked by uid 2149); 17 Aug 2004 17:27:13 -0000
Received: (qmail 67235 invoked from network); 17 Aug 2004 17:27:12 -0000
X-Message-Info: JGTYoYF78jEcb408jTll/5zNZ3AdAsyH
Mailing-List: contact xsl-list-help(_at_)lists(_dot_)mulberrytech(_dot_)com
Precedence: bulk
X-BL-Legal-Notice: <http://www.BIGLIST.com/legal/>
X-Complaints-To: <mailto:abuse(_at_)BIGLIST(_dot_)com>
List-Post: <mailto:xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
List-Help: <mailto:xsl-list-help(_at_)lists(_dot_)mulberrytech(_dot_)com>
List-Unsubscribe:
<mailto:xsl-list-unsubscribe-excel_man=hotmail(_dot_)com(_at_)lists(_dot_)mulberrytech(_dot_)com>
List-Subscribe: 
<mailto:xsl-list-subscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
Delivered-To: mailing list xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Message-Id: 
<6(_dot_)0(_dot_)0(_dot_)22(_dot_)0(_dot_)20040817122848(_dot_)02da7e30(_at_)earthlink(_dot_)net>
X-Mailer: QUALCOMM Windows Eudora Version 6.0.0.22
In-Reply-To: <f2a58075040816190764d3a0cf(_at_)mail(_dot_)gmail(_dot_)com>
References: <BAY9-F58huAOyvuga7k0003059a(_at_)hotmail(_dot_)com>
<f2a58075040816190764d3a0cf(_at_)mail(_dot_)gmail(_dot_)com>
Return-Path:
xsl-list-return-4757-excel_man=hotmail(_dot_)com(_at_)lists(_dot_)mulberrytech(_dot_)com
X-OriginalArrivalTime: 17 Aug 2004 17:28:07.0842 (UTC)
FILETIME=[8F9DE820:01C4847F]



Cezar,

At 10:07 PM 8/16/2004, Josh wrote:
How about something like this?
<xsl:value-of select="count(//MOP[number(.)&gt;0])"/>

I like this. It leverages your rule that open accounts are numbered,
whereas non-numbered accounts will cast to NaN when you use the number()
function. Hence, no lookup table is required.

Cheers,
Wendell

This is the situation: I need to get the number of currently open
account
(which is indicated by MOP element), If MOP value is a number, not a
2-char-code, then the current account is opened, otherwise it's close.
The
MOP number could be 01 - 09. This is the xml:



======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--+------------------------------------------------------------------
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>
--+--


_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus




--+------------------------------------------------------------------
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>
--+--




<Prev in Thread] Current Thread [Next in Thread>