xsl-list
[Top] [All Lists]

RE: XSL distinct group by date

2005-04-25 09:53:47
Hi,
The grouping tutorial helped a bit, but I'm not sure how to match by just
part of the content. This is the XSL I have so far:

<xsl:key name="documents-by-date" match="newsitem" use="date" />
        
<xsl:template match="news">
        <xsl:apply-templates
                        select="newsitem[generate-id(.) =
generate-id(key('documents-by-date', date)[1])]" />
</xsl:template>

<xsl:template match="newsitem">
        <xsl:value-of select="substring(date, string-length(date)-3, 4)" />
</xsl:template>

I have it so it outputs just the year portion of the date( ex: 5/6/2004),
but with the dates 5/6/2004, 5/7/2004, 4/8/2005, I want only 2004 & 2005 to
show up once.

Do I need to alter my xml to store the year seperately to group by it only?
This is current structure:

<news>
        <newsitem newsid="1">
                <title>news release1</title>
                <date>5/6/2004</date>
                <description></description>
                <fulltext></fulltext>
        </newsitem>
</news>

Thanks! I'm really learning a lot.

Mindy

-----Original Message-----
Date: Sun, 24 Apr 2005 08:56:55 +0100
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
Subject: RE: [xsl] XSL distinct group by date

Are you familiar with

http://www.jenitennison.com/xslt/grouping

which gives the standard XSLT 1.0 approaches to grouping problems?

Michael Kay
http://www.saxonica.com/ 




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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