xsl-list
[Top] [All Lists]

RE: [xsl] Extract unique values

2006-03-23 16:27:15
Thanks for your response. Should have used distinct-values() function at
first place.

-----Original Message-----
From: G. Ken Holman [mailto:gkholman(_at_)CraneSoftwrights(_dot_)com]
Sent: Friday, 24 March 2006 9:59 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Extract unique values


At 2006-03-24 09:46 +1100, SINGH Navpreet wrote:
I want to extract all the <c> from the following xml with uniqe 
values. So in the transformed, no two <c> element should have same
values.

This is a FFFFFFAQ.  Finding uniqueness is a subset of the grouping 
problem, so search the web for XSLT Grouping.

In our XSLT 1 training classes we teach that there are three ways to 
find uniqueness:  using axes, using keys (the Muenchian method) 
http://www.jenitennison.com/xslt/grouping/, and using variables 
http://www.biglist.com/lists/xsl-list/archives/200401/msg00070.html 
... each with pros and cons:

Axis method:
  - cons - slow, only sibling-wide or document-wide contexts

Key method:
  - pros - fastest, filtering done in predicates
  - cons - document-wide context

Variable method:
  - pros - document wide, sub-document, or multi-document contexts
         - faster than axis method
  - cons - slower than key method
         - filtering not done in predicates

Grouping is built in to XSLT 2 as a language feature.

I hope this helps.

. . . . . . . . Ken

--
Upcoming XSLT/XSL-FO hands-on courses: Washington,DC 2006-06-12/16
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>