Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] grouping and discarding duplicates

From: "Vasu Chakkera" <vasucv@----------->
To:
Date: 7/1/2004 6:06:00 PM
Hi Nathan,
I cant completely write your XSL. infact I havent even looked at your XSL
code.
What I have done will take you in the direction ...
I have written an xsl that will eliminate duplicate
<xcal:vevent>
with the same <obprcal:eventid> value

in other words, if there are more than one
<xcal:vevent> with the same value for <obprcal:eventid>,
then only one of them will be selected.

Following is the code...

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:obprcal="http://spaceresearch.nasa.gov/calendar"
xmlns:xcal="http://www.ietf.org/internet-drafts/draft-ietf-calsch-many-xcal-
01.txt" xmlns="http://spaceresearch.nasa.gov/calendar">
 <xsl:key match="/obprcal:top/xcal:vcalendar/xcal:vevent" name="events"
use="obprcal:eventid"/>
 <xsl:template match="/">
  <!-- get unioe-nodes -->
  <xsl:for-each
select="/obprcal:top/xcal:vcalendar/xcal:vevent[generate-id(.) =
generate-id(key('events',obprcal:eventid)[1])]">
   <xsl:sort order="ascending" data-type="number" select="obprcal:eventid"/>
   <xsl:value-of select="obprcal:eventid"/>
<!--

you can add your code here,, I have just printed the value of
obprcal:eventid, so that you see the result ..
-->
   <br/>
  </xsl:for-each>
 </xsl:template>
</xsl:stylesheet>

First Run this xsl as is against your XML and see if you are happy ..

Let me know if  thaz not what you want

Hope this helps
Vasu Chak


----- Original Message ----- 
From: "Nathan Shaw" <n8_shaw@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, July 01, 2004 4:03 PM
Subject: [xsl] grouping and discarding duplicates


> Hi all. I have an XSLT that sorts and groups on date
> per category. However, the client has changed the
> specs and now wants multiple categories and an All
> Categories page. This means that I have to shed
> duplicate events that appear in different categories
> and group the categories for display. I have spent a
> day and a half trying to figure out how to do this
> without much luck.
>
> What I want to end up with is a record like this:
>
> <DataTableRow>
>   <DataTableRowCell><strong>HOLIDAY - Labor
> Day</strong></DataTableRowCell>
> </DataTableRow>
> <DataTableRow>
>   <DataTableRowCell>September 06, 2004 08:00
> AM-September 06, 2004 05:00 PM (All
> Day)</DataTableRowCell>
> </DataTableRow>
> <DataTableRow>
>   <DataTableRowCell>Categories: Education Events,
> External Technical Meetings, General Interest, Public
> Outreach Events, Industry</DataTableRowCell>
> <DataTableRow>
>   <DataTableRowCell> </DataTableRowCell>
> </DataTableRow>
>
> Can someone lend a hand? The XML and XSLT files are
> too large to include, but can be downloaded here, in
> the XML-XSLT folder:
>
> http://briefcase.yahoo.com/n8shaw
>
> Thanks a bunch in advance!
>
> --Nathan
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> http://promotions.yahoo.com/new_mail
>
> --+------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
>
>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent