Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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
  #2 (permalink)  
Old February 27th, 2006, 08:01 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
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


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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.