Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 27th, 2006, 07:22 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default For-each issues

Hi,

I am a bit of a newbie with XSL and I am stuck with the following issue.

I am selecting a bunch of "Date" records with a for-each loop, from that I then want to (within that for-each loop) grab all the records associated with a certain date.

So for instance:

Date1: Item1, Item2, Item3
Date2: Item4, Item5, Item6 etc.

But I can't seem to wrap my head around the syntax for doing this.
right now my code outputs this

Date1: Item1
Date1: Item2
Date1: Item3
Date2: Item4
etc.

Thats with one for-each loop.

So once I have selected all the "Date" records how do I then compare within that to get all the records associated with the certain date?

I tried doing it with a nested for-each loop, where I was just selecting all the "Date" records again with a for-each, the same as the parent for-each loop, but it ends up not working.

Any ideas? Is there a much easier way to do this? As I said, I'm a newbie, I've been working with XSL for about three days.

hiskeyd
http://www.vicasting.com
Reply With Quote
  #2 (permalink)  
Old February 27th, 2006, 08:01 PM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It's a bit hard to work out what the problem is as you haven't shown the structure of your data and you haven't shown any code. Are there duplicate dates and you want to process each group of duplicates once only? In that case, it's a grouping problem. Grouping is quite tough to tackle in XSLT 1.0 - see www.jenitennison.com/xslt/grouping for advice - it gets much easier in 2.0 with an xsl:for-each-group construct.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
connection string issues, web.config file issues kaliaparijat ASP.NET 2.0 Professional 1 June 12th, 2008 08:07 AM
IE Issues iPagan BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 April 1st, 2007 04:11 AM
Still Having Issues slas7713 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 9 October 27th, 2006 02:59 PM
Issues with xp_cmdshell ninel SQL Server 2000 1 August 26th, 2006 09:39 AM



All times are GMT -4. The time now is 08:12 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.