SunQuest
           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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 18th, 2003, 10:44 AM
RavaGe RavaGe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Posts: 10 RavaGe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Sorting across various levels

I'm trying to sort a list of performances by date. Unfortunately, they do not have a common parent. Instead, my XML code looks like this:

Code:
<season>
	<concert id="1">
		<foo></foo>
		<bar></bar>
		<performance id="11">
			<begin>2003-08-18 16:00:00</begin>
		</performance>
		<performance id="12">
			<begin>2003-08-20 12:00:00</begin>
		</performance>
	</concert>
	<concert id="2">
		<foo></foo>
		<bar></bar>
		<performance id="13">
			<begin>2003-08-16 12:00:00</begin>
		</performance>
	</concert>
</season>


I want to output a list in chronological order by performance/begin that looks like this:

Code:
concert	performance	time
2	13		2003-08-16 12:00:00
1	11		2003-08-18 16:00:00
1	12		2003-08-20 12:00:00


What is the best approach to doing this? At this point, i'm not even sure if I'm going the right way with <xsl:copy-of /> or if I should be working with groupings etc. Any point in the right direction would be helpful. Thank you!

Reply With Quote
  #2  
Old August 19th, 2003, 06:42 PM
mulligh mulligh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 19 mulligh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>

<xsl:template match="/">
<table>
<tr><td>Concert</td><td>Performance</td><td>Time</td></tr>
<xsl:for-each select="//begin">
<xsl:sort/>
<tr>
<td><xsl:value-of select="ancestor::concert/@id"/></td>
<td><xsl:value-of select="parent::performance/@id"/></td>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Sorting across various levels


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


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





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