[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Building a table with for-each

Subject: Building a table with for-each
From: "Selchow, Matt" <Matt.Selchow@xxxxxxxxxxxxxxxxx>
Date: Wed, 18 May 2005 14:07:11 -0500
building a table
Please bear with me as I'm new to this. I had a perfect solution to my
problem but it was accidentally wiped out. I'm trying to build a table
using 'for-each'. I've built separate tables for each of the unique
nodes, i.e. Sales, Credits, etc. However the last table uses
<type>DayXX</type, where XX is a number 0 -11. For the life of me I
can't remember how I did my 'for-each' statement to build that table
with multiple rows. I've been searching through the archive as I'm
pretty sure I used an example from there but I can't find it. I'm pretty
sure my code was something like this but it just isn't cutting it:

</table>
  <table border="1" id="table5" width="100%">
     <tr bgcolor="#E1ECFC">
         <th>Date</th>
         <th>Orders</th>
    </tr>
  <xsl:for-each select="xTable/orders[type=(., 'Day')]">
     <tr>
         <td><xsl:value-of select="date"/></td>
         <td><xsl:value-of select="count"/></td>
    </tr>
   </xsl:for-each>
</table>



Here's my xml:

<xTable>
	<orders>
		<type>Sales</type>
		<count>486</count>
		<value>18</value>
	</orders>
	<orders>
		<type>Credits</type>
		<count>17</count>
		<value>169.11</value>
	</orders>
	<orders>
		<type>Coupons</type>
		<count>6</count>
		<value>100.00</value>
	</orders>
	<orders>
		<type>Replacements</type>
		<count>3</count>
		<value>0</value>
	</orders>
	<orders>
		<type>Day0</type>
		<count>1,894</count>
		<value/>
		<date>04/28</date>
	</orders>
	<orders>
		<type>Day1</type>
		<count>1,792</count>
		<value/>
		<date>04/29</date>
	</orders>
	<orders>
		<type>Day2</type>
		<count>30</count>
		<value/>
		<date>04/30</date>
	</orders>
	<orders>
		<type>Day3</type>
		<count>2,306</count>
		<value/>
		<date>05/02</date>
	</orders>
	<orders>
		<type>Day4</type>
		<count>2,086</count>
		<value/>
		<date>05/03</date>
	</orders>
	<orders>
		<type>Day5</type>
		<count>1,913</count>
		<value/>
		<date>05/04</date>
	</orders>
	<orders>
		<type>Day6</type>
		<count>1,896</count>
		<value/>
		<date>05/05</date>
	</orders>
	<orders>
		<type>Day7</type>
		<count>1,829</count>
		<value/>
		<date>05/06</date>
	</orders>
	<orders>
		<type>Day8</type>
		<count>39</count>
		<value/>
		<date>05/07</date>
	</orders>
	<orders>
		<type>Day9</type>
		<count>2,053</count>
		<value/>
		<date>05/09</date>
	</orders>
	<orders>
		<type>Day10</type>
		<count>486</count>
		<value/>
		<date>05/10</date>
	</orders>
	<orders>
		<type>Day11</type>
		<count>102</count>
		<value/>
		<date>05/11</date>
	</orders>
</xTable>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.