XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old June 1st, 2001, 07:07 AM
Miska's Avatar
Miska Miska is offline
Madden Maniac
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2001
Location: Finland
Posts: 519 Miska User rank is Lance Corporal (50 - 100 Reputation Level)Miska User rank is Lance Corporal (50 - 100 Reputation Level)Miska User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Day 3 h 47 m 50 sec
Reputation Power: 7
creating a table

I have the following kind of XML-file that I wish to convert to HTML table:

<DATASET>
<TIMESTAMP>1.6.2001 14:22:11</TIMESTAMP>
<ROW>
<PRODUCT_NAME>DeLuxeBar</PRODUCT_NAME>
<MACHINE_ID>123456</MACHINE_ID>
<SALE_TIME>2001-06-01 14:22:05</SALE_TIME>
<SALE_COUNT>1</SALE_COUNT>
<SALE_PRICE>55</SALE_PRICE>
<_SALE_COUNTxSALE_PRICE_>55</_SALE_COUNTxSALE_PRICE_>
</ROW>
<ROW>
<PRODUCT_NAME>Diet Snack</PRODUCT_NAME>
<MACHINE_ID>123456</MACHINE_ID>
<SALE_TIME>2001-06-01 14:22:05</SALE_TIME>
<SALE_COUNT>1</SALE_COUNT>
<SALE_PRICE>10</SALE_PRICE>
<_SALE_COUNTxSALE_PRICE_>10</_SALE_COUNTxSALE_PRICE_>
</ROW>

my XSL-file considering the table is following:

<TR>
<TH>Machine</TH>
<TH>Sale Count</TH>
<TH>Sale</TH>
<TH>Average Sale</TH>
</TR>

<TR>
<TD align="center"><xsl:value-of select="DATASET/ROW/MACHINE_ID"/></TD>
<TD align="center"><xsl:value-of select="sum(DATASET/ROW/SALE_COUNT)"/></TD>
<TD align="center"><xsl:value-of select="sum(DATASET/ROW[MACHINE_ID=123456]/_SALE_COUNTxSALE_PRICE_)"/></TD>
<xsl:variable name='ekaaverage' select="sum(DATASET/ROW[MACHINE_ID=123456]/_SALE_COUNTxSALE_PRICE_) div sum(DATASET/ROW[MACHINE_ID=123456]/SALE_COUNT)"/>
<TD align="center"><xsl:value-of select='format-number($ekaaverage, "##0.00")'/></TD>
</TR>
<TR>
<TD align="center"><xsl:value-of select="DATASET/ROW[MACHINE_ID=234567]/AUT_ID"/></TD>
<TD align="center"><xsl:value-of select="sum(DATASET/ROW[MACHINE_ID=234567]/SALE_COUNT)"/></TD>
<TD align="center"><xsl:value-of select="sum(DATASET/ROW[MACHINE_ID=234567]/_SALE_COUNTxSALE_PRICE_)"/></TD>
<xsl:variable name='tokaaverage' select="sum(DATASET/ROW[MACHINE_ID=234567]/_SALE_COUNTxSALE_PRICE_) div sum(DATASET/ROW[MACHINE_ID=234567]/SALE_COUNT)"/>
<TD align="center"><xsl:value-of select='format-number($tokaaverage, "##0.00")'/></TD>
</TR>
<TR>

So I finally get to the question... My XML data has MACHINE_ID:s that can be any number.XML-file is also growing all the time as the XML-file is created from a database. And I wish to create a table in html so that the data is sorted by MACHINE_ID. The HTML-table can have any amount of rows depending on how many different MACHINE_ID:s there are.And that's giving me a hard time...(2 days). Could I use <xsl:for-each> somehow??? Or is there a alternative method?

Reply With Quote
  #2  
Old June 5th, 2001, 01:17 AM
Miska's Avatar
Miska Miska is offline
Madden Maniac
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2001
Location: Finland
Posts: 519 Miska User rank is Lance Corporal (50 - 100 Reputation Level)Miska User rank is Lance Corporal (50 - 100 Reputation Level)Miska User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Day 3 h 47 m 50 sec
Reputation Power: 7
Talking Actually it was quite easy...

the answer was actually so simple. Just a bit diiferent SQL query and then it worked with for-each... Finally a word of advise enjoy your summer!!! I know I will...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > creating a table


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway