This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: removing duplicates from sorted list
- From: "Joerg Heinicke" <joerg dot heinicke at gmx dot de>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Mon, 17 Dec 2001 21:37:53 +0100
- Subject: Re: [xsl] removing duplicates from sorted list
- References: <003401c1871c$72e922c0$9c6943d4@ahmad-laptop>
- Reply-to: xsl-list at lists dot mulberrytech dot com
preceding-sibling is restricted to the same parent-node.
<nodes>
<node1>
<node3/>
<node4/>
</node1>
<node2>
<node5/>
<node6/>
</node2>
</nodes>
So node4 is a preceding-sibling one to node3, but node 5 isn't one. It's
only a preceding one.
Hope this helps,
Joerg
----- Original Message -----
> Hi,
>
> I think the for-each has to check each target character id node with
> every other one and not just the preceeding one, so I've tried
> 'preceding' and 'ancestor' to check all up to the root but the
> duplicates are still there...anyone?
>
> Ahmad.
>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="html"/>
>
> <xsl:template match ="/">
> <html>
> <body>
> <xsl:for-each select="LOG/DIRECT/TARGET_CHARACTER_ID[. !=
> preceding-sibling::TARGET_CHARACTER_ID]">
> <xsl:sort select="." data-type="number"
> order="ascending" />
> <xsl:value-of select="position()" /><xsl:value-of
> select="." />
> </xsl:for-each>
> </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
>
> My xml doc looks like this:-
>
> <LOG>
> <DIRECT>
> <COMMUNICATION_TYPE> PAGETELL </COMMUNICATION_TYPE>
> <Invoc_serial> 27 </Invoc_serial>
> <Serial> 3087908 </Serial>
> <USAGE> TELL </USAGE>
> <MESSAGE_TYPE> EMOTE </MESSAGE_TYPE>
> <CHARACTER_ID> 44639 </CHARACTER_ID>
> <CHARACTER_STATUS> 3 </CHARACTER_STATUS>
> <LOCATION_ID> 45040 </LOCATION_ID>
> <TARGET_CHARACTER_ID> 2346456 </TARGET_CHARACTER_ID>
> <TARGET_CHARACTER_STATUS> 6 </TARGET_CHARACTER_STATUS>
> <TARGET_CHARACTER_LOCATION_ID> 23222
> </TARGET_CHARACTER_LOCATION_ID>
> <MESSAGE>hello</MESSAGE>
> <TIME> 'Mon, 26 Nov 2001 15:40:29 +0000' </TIME>
> </DIRECT>
>
> *then a few hundred more like that*
>
> </LOG>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list