xsl-list
[Top] [All Lists]

RE: grouping and sorting by date

2004-03-03 08:29:20
Thanks Jarno. I did not see your earlier reply, sorry.
I figured that I either did not include enough details
or that my post was simply lost in the chop.

One question for you... could this be accomplished
using template matching instead of for-each loops?

Thanks for your help. This should at least get me
started and heading in the right direction!

--Nathan


--- Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com wrote:
Hi,

I am trying to group and sort by date in an xslt I
am
working on going from xml to html. Specifically, I
am
trying to sort by year, month and then day on an
event's start date. It appears that I may need to
use
keys and a sorting method to do this. I have
looked
through the FAQs and other tutorials, but I am
having
trouble grokking it. Can someone lend some help?

Didn't I or someone else here already reply to you
about the sorting? Could you elaborate on exactly
what do you have problems with? First declare the
key to be used in the Muechian grouping

  <xsl:key name="group" match="xcal:vevent"
use="substring-before(xcal:dtstart, ' ')"/>

then group and sort with

  â?¦
  <!-- process groups -->
  <xsl:for-each select="xcal:vevent[generate-id(.) =
generate-id(key('group',
substring-before(xcal:dtstart, ' ')))]">
    <xsl:sort
select="translate(substring-before(xcal:dtstart, '
'), '-', '')" data-type="number" />
    <!-- process group members -->
    <xsl:for-each select="key('group',
substring-before(xcal:dtstart, ' '))">
      â?¦
    </xsl:for-each>
  </xsl:for-each>
  â?¦

Cheers,

Jarno - Chris C: Vengeance Is Mine

 XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list



__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you?re looking for faster
http://search.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>