Subject: Re: [xsl] Split with delimiter and remove duplicate using XSL 1.0|
From: "ollie de guzman" <deguzman.ollie@xxxxxxxxx>
Date: Mon, 7 Jul 2008 15:04:01 +0800
Hi all! Thanks for your insights and suggestions. I really appreciate it.. Sir Paul, I ve tried your solution you posted on your blog and it worked. Thanks a lot. A sigh of relief and less headache for me! =) Cheers! Ollie de Guzman Philippines On Fri, Jul 4, 2008 at 11:07 PM, Paul Kiel <paul@xxxxxxxxxxxxxxx> wrote: > Hi Folks, > > Yes, xslt 2.0 is great and solves problems. But I've had to get distinct values with an xslt 1.0 requirement (and no > extensions) numerous times. I've posted a blog entry on this with an example. It uses a delimited list and then > interates through the list using a template. > > http://www.xmlhelpline.com/blog/stories/2007/05/06/xslt10GroupingIteratingAndUniquenessWithoutKeys.html > > It isn't elegant, but it works. Xslt 1.0 and no extensions nor keys. > For what its worth. > > Cheers, > Paul > > > > ===================================================== > W. Paul Kiel > xmlHelpline.com Consulting > paul@xxxxxxxxxxxxxxx > work: 919-846-0224 > cell: 919-449-8801 > website: http://www.xmlhelpline.com > Your helpline for data integration solutions. > ===================================================== > > > > -----Original Message----- > From: ollie de guzman [mailto:deguzman.ollie@xxxxxxxxx] > Sent: Friday, July 04, 2008 3:19 AM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Split with delimiter and remove duplicate using XSL 1.0 > > Hi all! > > I am new to XSL programming and I was tasked to solve the problem I stated on my subject. > As i was browsing the mailing list, i chanced upon this reply > > Martin Wrote: I would first tokenize, then use xsl:for-each-group to remove duplicates: > > Perfect. I am going through the tutorials to understand <xsl:for-each-group> and it use. Still needs to look into the > correct usage of current-group() and current-group-key(), group-by , group-adjacent etc. <xsl:copy-of > select="current-group()"/> > > Time to get seriously involve myself in exploring 2.0. :-) > > Thanks again Martin. > > Pankaj > > I know that this problem can be solved using functions in XSL 2.0 like tokenize, the use of regular expressions and > etc.. but my question is, can it be solved using purely XSL 1.0 functions? > (without the use of tokenize and regex) > > Example. > > If i have this tag: > > <sample> > ... > ... > <text>Sample Text 1Sample Text 1Sample Text 2</text> > > ... > ... > </sample> > > How can i get this output? The text would be parsed using  as the delimiter then remove duplicate values (Sample Text > 1) > > <out>Sample Text 1</out> > <out>Sample Text 2</out> > > > Any suggestions? > > Thanks a lot in advance. > > Ollie de Guzman > Philippines > > No virus found in this incoming message. > Checked by AVG. > Version: 8.0.134 / Virus Database: 270.4.5/1533 - Release Date: 7/3/2008 7:19 PM > > -- Ollie S. de Guzman Lead Programmer Technical Support Group Globalink Holdings Corporation +632 8079772 local 8021 "Big things happen to those who dream big!"