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:
  #1  
Old January 5th, 2004, 03:26 PM
postgres_dev postgres_dev is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 postgres_dev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How to use group by in xsl

I got one xml like this:
---------------------------------------------------------------------------------
<example>
<row>
<name>Peter</name>
<coursename>France</coursename>
<tuition>100</tuition>
<age>41</age>
</row>
<row>
<name>Mark</name>
<coursename>English</coursename>
<tuition>200</tuition>
<age>33</age>
</row>
<row>
<name>Peter</name>
<coursename>Spanish</coursename>
<tuition>300</tuition>
<age>41</age>
</row>
<row>
<name>Peter</name>
<coursename>English</coursename>
<tuition>200</tuition>
<age>41</age>
</row>
<row>
<name>Mark</name>
<coursename>France</coursename>
<tuition>100</tuition>
<age>33</age>
</row>
<row>
<name>John</name>
<coursename>France</coursename>
<age>53</age>
</row>
</example>
-----------------------------------------------------------------------
I would like to get the output could be group by name and the age should be older than 40.

just like this

Peter
English
France
Spanish
John
France

I tyied <xsl:for-each-group> and can't get it work. Any ideaqs.

Thanks

Reply With Quote
  #2  
Old January 5th, 2004, 03:38 PM
nolachrymose nolachrymose is offline
The Forest
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 321 nolachrymose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
The tag is <xsl:for-each>, with select being the attribute corresponding to the elements which will be read, in your case, your for-each tag will probably look like this:

Code:
<xsl:for-each select="example/row">


Hope that helps!

Happy coding!

Reply With Quote
  #3  
Old January 5th, 2004, 03:48 PM
postgres_dev postgres_dev is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 postgres_dev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the quick reply. But I need to goup the name for output

Reply With Quote
  #4  
Old January 19th, 2004, 03:55 PM
imillar imillar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Toronto Canada
Posts: 7 imillar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to imillar
Try this:

<xsl:for-each select="example/row[age > '40']/name">
<xsl:sort select="." />
<xsl:value-of select="." />
</xsl:for-each>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > How to use group by in xsl


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 4 hosted by Hostway