Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old June 24th, 2008, 02:14 PM
Registered User
 
Join Date: Jun 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default I need to omit the duplicate values when displayin

Hello,

The below is my XML code

<course_cat>

      <course>
         <Day>Thursday, September 25 </Day>
         <Time>8:30-10:00 AM</Time>
     <Title>VM100 Fine-Needle Aspiration of the Salivary </Title>
     </course>

      <course>
         <Day>Thursday, September 25 </Day>
         <Time>8:30-10:00 AM</Time>
     <Title>VM101 Tactics for Tackling Common </Title>
     </course>

     <course>
        <Day>Friday, September 26</Day>
        <Time>8:30-10:00 AM</Time>
        <Title>VM107 Standardization and Troubleshooting </Title>
    </course>

<course_cat>

The below is my XSL code:

  <xsl:for-each select="course_cat/course">
           <tr><xsl:value-of select="Day"/></tr><br/>
           <tr><xsl:value-of select="Time"/></tr><br/>
          <tr> <xsl:value-of Title"/></tr>
   </xsl:for-each>

Here the Time is same for all of the course I just want to display once if the time is same.

But with my code I am displaying the time repetatively.

This is my output:

Thursday, September 25
8:30-10:00 AM
VM100 Fine-Needle Aspiration of the Salivary Gland:William C.Faquin,

Thursday, September 25
8:30-10:00 AM
VM101 Tactics for Tackling Common Pathology


Friday, September 26
8:30-10:00 AM
VM107 Standardization and Troubleshooting

But I want the output to display like this:

Thursday, September 25
8:30-10:00 AM

VM100 Fine-Needle Aspiration of the Salivary Gland:William C.Faquin,
VM101 Tactics for Tackling Common Pathology


Friday, September 26
8:30-10:00 AM
VM107 Standardization and Troubleshooting







 
Old June 24th, 2008, 06:13 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Google for "XSLT Grouping". In XSLT 2.0 use xsl:for-each-group (which makes it very easy), in XSLT 1.0 use the Muenchian grouping technique (which looks very complicated at first sight, but you get used to it).

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
How Do I avoid duplicate values xsltier XSLT 3 June 4th, 2008 01:36 PM
allow duplicate values in index key pawatz70 Access 3 November 12th, 2007 07:41 PM
Detecting duplicate values Europom Excel VBA 2 May 29th, 2007 07:09 AM
how can i check for duplicate values before saving noor ASP.NET 1.0 and 1.1 Basics 3 June 10th, 2005 09:28 AM
Omit negative values in Queries - Access 97 snoopy92211 Access VBA 1 October 13th, 2004 12:24 PM





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