xsl-list
[Top] [All Lists]

Re: [xsl] Find distinct nodes from a sequence

2011-07-07 03:15:29
On 7 July 2011 09:05, Pushkar Khadilkar
<Pushkar_Khadilkar(_at_)persistent(_dot_)co(_dot_)in> wrote:
Hi List,

I have a function “getNodes()” that returns a sequence of nodes( >= 1) from 
source tree by “xsl:sequence” statement.

I want to remove duplicate nodes from this sequence.

The duplicate nodes in the sequence are not different nodes from source tree 
with same values for some attributes but actually refer to same node in 
source tree.

For example , Consider following tree

<person name=”a”/>
<person name=”b”/>

The function “getNodes()” might return a sequence containing 2 nodes both of 
which refer to same node (<person name=”a”/>) of the source tree.

Group them by their generated id:

<xsl:for-each-group select="$seq" group-by="generate-id(.)">




-- 
Andrew Welch
http://andrewjwelch.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>
--~--