[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How do I compare all similar type nodes?

Subject: How do I compare all similar type nodes?
From: "Ahmad J Reeves" <ahmad@xxxxxxxxxxxxxx>
Date: Mon, 17 Dec 2001 23:04:36 -0000
xsl prevent duplicates
Hi,

I am trying to remove duplicate copies of context nodes from a sorted
list. 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>

My revised xml stylesheet as is looks like this:-(thanks chris)

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

The output still includes duplicates from the sorted list. I think preceding
sibling doesnt compare all target_character_id nodes against eachother,
how can I do this to prevent prinitng out duplicates?

Cheers

Ahmad
1. 23220
2. 23470
3. 23470
4. 23470
5. 23470
6. 23470
7. 23470
8. 83470
9. 212120
10. 223232
11. 231212
12. 2346456
13. 27675340

Cheers

Ahmad.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.