Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 9th, 2004, 04:59 PM
Authorized User
 
Join Date: Jul 2003
Location: atlanta, ga, USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Element value to be shown only once...HOW?

Hi all,

Below is the XML I have,

<root>
      <CREDITCOMMENT>
          <Comment>BIG LINE 1</Comment>
      </CREDITCOMMENT>
      <CREDITCOMMENT>
          <Comment>Active Duty</Comment>
      </CREDITCOMMENT>
      <CREDITCOMMENT>
          <Comment>BIGPERSON BILL</Comment>
      </CREDITCOMMENT>
      <CREDITCOMMENT>
          <Comment>BIGPERSON BILL</Comment>
      </CREDITCOMMENT>
      <CREDITCOMMENT>
          <Comment>BIGPERSON BILL</Comment>
      </CREDITCOMMENT>
      <CREDITCOMMENT>
          <Comment>BIGPERSON BILL</Comment>
      </CREDITCOMMENT>
      <CREDITCOMMENT>
          <Comment>Active Duty</Comment>
      </CREDITCOMMENT>
      <CREDITCOMMENT>
          <Comment>BIG LINE 1</Comment>
    </CREDITCOMMENT>
</root>

Can someone help me in writting the xsl so that the html will display the Comment only once, Like, below????

========================
BIG LINE 1
Active Duty
BIGPERSON BILL
========================

Thanks in-advance
Suri

Reply With Quote
  #2 (permalink)  
Old August 10th, 2004, 07:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

eliminate the duplicates with a selection like this:
Code:
<xsl:apply-templates select="root/CREDITCOMMENT[not(Comment=preceding-sibling::CREDITCOMMENT/Comment)]"/>
output the comment with a template like this:
Code:
<xsl:template match="CREDITCOMMENT">
    <xsl:value-of select="Comment"/><br/>
</xsl:template>
Reply With Quote
  #3 (permalink)  
Old August 10th, 2004, 10:51 AM
Authorized User
 
Join Date: Jul 2003
Location: atlanta, ga, USA.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks alot..!

It works.

regards
suri

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem adding element to the previous element dani1 XSLT 5 September 10th, 2008 01:38 AM
results shown by query Vince_421 Access 1 February 4th, 2007 12:45 PM
SetDataSource is ignored, the whole table is shown anjulis Crystal Reports 0 October 20th, 2006 12:26 PM
adding of element and assigning to one element sushovandatta XSLT 2 November 16th, 2004 07:04 PM
How to verify if form is shown pavel VB How-To 3 October 1st, 2004 01:10 AM



All times are GMT -4. The time now is 12:14 PM.


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