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

duplicate test

Subject: duplicate test
From: Ahmad J Reeves <ahmad@xxxxxxxxxxxxxx>
Date: Tue, 09 Apr 2002 14:07:43 +0100
prefix suffix test
Hi,

I'm trying to remove duplicates from a list of characters
when they are sending multiple messages in a room until they leave and
come back in. My stylesheet is as follows: -

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" /> 
  
<xsl:key name="kByID" match="DIRECT | LOCAL | GLOBAL | ADMIN"
use="LOCATION_ID" /> 

<xsl:variable name="vLocations" select="LOG/*[generate-id() =
generate-id(key('kByID', LOCATION_ID)[1])]" /> 

<xsl:variable name="NL" select="' '" /> 

<xsl:template match="/">

<xsl:for-each select="$vLocations">

 <xsl:value-of select="concat('Location: ', LOCATION_ID, ':', $NL )" /> 

  <xsl:for-each select="/LOG/*/LOCATION_ID [. = current()/LOCATION_ID]">

   <xsl:if test="not(../CHARACTER_ID =
../preceding-sibling::DIRECT                   [CHARACTER_ID =
current()[1]/CHARACTER_ID)">
      <xsl:value-of select="concat(' ', ../CHARACTER_ID, $NL)" /> 
  </xsl:if>
  
 </xsl:for-each>

</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
------------------------------------------------------------------------

and with the following xml: -
<LOG>
   <DIRECT>
      <COMMUNICATION_TYPE> PAGETELL </COMMUNICATION_TYPE>
      <Invoc_serial> 29 </Invoc_serial>
      <Serial> 19461910 </Serial>
      <USAGE> TELL </USAGE>
      <MESSAGE_TYPE> EMOTE </MESSAGE_TYPE>
      <CHARACTER_ID> 10010 </CHARACTER_ID>
      <CHARACTER_STATUS> 6 </CHARACTER_STATUS>
      <LOCATION_ID> 24488 </LOCATION_ID>
      <TARGET_CHARACTER_ID> 18735 </TARGET_CHARACTER_ID>
      <TARGET_CHARACTER_STATUS> 6 </TARGET_CHARACTER_STATUS>
      <TARGET_CHARACTER_LOCATION_ID> 10433
</TARGET_CHARACTER_LOCATION_ID>
      <MESSAGE> %#NF#%wthinks %y%l. o O ( %w%lThinks of a new
prefix/suffix.%y%l ) </MESSAGE>
      <TIME> 'Tue, 01 Jan 2002 20:27:50 +0000' </TIME>
   </DIRECT>
   <DIRECT>
      <COMMUNICATION_TYPE> PAGETELL </COMMUNICATION_TYPE>
      <Invoc_serial> 29 </Invoc_serial>
      <Serial> 19461911 </Serial>
      <USAGE> TELL </USAGE>
      <MESSAGE_TYPE> EMOTE </MESSAGE_TYPE>
      <CHARACTER_ID> 10010 </CHARACTER_ID>
      <CHARACTER_STATUS> 6 </CHARACTER_STATUS>
      <LOCATION_ID> 24488 </LOCATION_ID>
      <TARGET_CHARACTER_ID> 23212 </TARGET_CHARACTER_ID>
      <TARGET_CHARACTER_STATUS> 3 </TARGET_CHARACTER_STATUS>
      <TARGET_CHARACTER_LOCATION_ID> 293 </TARGET_CHARACTER_LOCATION_ID>
      <MESSAGE> %#NF#%wthinks %y%l. o O ( %w%lThinks of a new
prefix/suffix.%y%l ) </MESSAGE>
      <TIME> 'Tue, 01 Jan 2002 20:27:50 +0000' </TIME>
   </DIRECT>
   <DIRECT>
      <COMMUNICATION_TYPE> PAGETELL </COMMUNICATION_TYPE>
      <Invoc_serial> 29 </Invoc_serial>
      <Serial> 19461912 </Serial>
      <USAGE> TELL </USAGE>
      <MESSAGE_TYPE> EMOTE </MESSAGE_TYPE>
      <CHARACTER_ID> 10010 </CHARACTER_ID>
      <CHARACTER_STATUS> 6 </CHARACTER_STATUS>
      <LOCATION_ID> 24488 </LOCATION_ID>
      <TARGET_CHARACTER_ID> 16783 </TARGET_CHARACTER_ID>
      <TARGET_CHARACTER_STATUS> 5 </TARGET_CHARACTER_STATUS>
      <TARGET_CHARACTER_LOCATION_ID> 39784
</TARGET_CHARACTER_LOCATION_ID>
      <MESSAGE> %#NF#%wthinks %y%l. o O ( %w%lThinks of a new
prefix/suffix.%y%l ) </MESSAGE>
      <TIME> 'Tue, 01 Jan 2002 20:27:50 +0000' </TIME>
   </DIRECT>
   <DIRECT>
      <COMMUNICATION_TYPE> PAGETELL </COMMUNICATION_TYPE>
      <Invoc_serial> 29 </Invoc_serial>
      <Serial> 19461913 </Serial>
      <USAGE> TELL </USAGE>
      <MESSAGE_TYPE> EMOTE </MESSAGE_TYPE>
      <CHARACTER_ID> 10010 </CHARACTER_ID>
      <CHARACTER_STATUS> 6 </CHARACTER_STATUS>
      <LOCATION_ID> 34567 </LOCATION_ID>
      <TARGET_CHARACTER_ID> 35257 </TARGET_CHARACTER_ID>
      <TARGET_CHARACTER_STATUS> 4 </TARGET_CHARACTER_STATUS>
      <TARGET_CHARACTER_LOCATION_ID> 293 </TARGET_CHARACTER_LOCATION_ID>
      <MESSAGE> %#NF#%wthinks %y%l. o O ( %w%lThinks of a new
prefix/suffix.%y%l ) </MESSAGE>
      <TIME> 'Tue, 01 Jan 2002 20:27:50 +0000' </TIME>
   </DIRECT>
   <DIRECT>
      <COMMUNICATION_TYPE> PAGETELL </COMMUNICATION_TYPE>
      <Invoc_serial> 29 </Invoc_serial>
      <Serial> 19461994 </Serial>
      <USAGE> TELL </USAGE>
      <MESSAGE_TYPE> STD </MESSAGE_TYPE>
      <CHARACTER_ID> 20241 </CHARACTER_ID>
      <CHARACTER_STATUS> 3 </CHARACTER_STATUS>
      <LOCATION_ID> 31132 </LOCATION_ID>
      <TARGET_CHARACTER_ID> 14211 </TARGET_CHARACTER_ID>
      <TARGET_CHARACTER_STATUS> 5 </TARGET_CHARACTER_STATUS>
      <TARGET_CHARACTER_LOCATION_ID> 3726
</TARGET_CHARACTER_LOCATION_ID>
      <MESSAGE> "lol I found my own ways to amuse myself tho...like when
liv tyler went 'ive got to take him to my father' im like yayaay were
going to se steve tylerrrrr!!! " </MESSAGE>
      <TIME> 'Tue, 01 Jan 2002 20:28:08 +0000' </TIME>
   </DIRECT>
   <DIRECT>
      <COMMUNICATION_TYPE> PAGETELL </COMMUNICATION_TYPE>
      <Invoc_serial> 29 </Invoc_serial>
      <Serial> 19461995 </Serial>
      <USAGE> TELL </USAGE>
      <MESSAGE_TYPE> STD </MESSAGE_TYPE>
      <CHARACTER_ID> 10010 </CHARACTER_ID>
      <CHARACTER_STATUS> 3 </CHARACTER_STATUS>
      <LOCATION_ID> 24488 </LOCATION_ID>
      <TARGET_CHARACTER_ID> 12969 </TARGET_CHARACTER_ID>
      <TARGET_CHARACTER_STATUS> 3 </TARGET_CHARACTER_STATUS>
      <TARGET_CHARACTER_LOCATION_ID> 111 </TARGET_CHARACTER_LOCATION_ID>
      <MESSAGE> "lol I found my own ways to amuse myself tho...like when
liv tyler went 'ive got to take him to my father' im like yayaay were
going to se steve tylerrrrr!!! " </MESSAGE>
      <TIME> 'Tue, 01 Jan 2002 20:28:08 +0000' </TIME>
   </DIRECT>
 </LOG>

produces

Location:  24488 :
     10010 
     10010 * shouldnt be here as still in same room
     10010 * ditto
     10010 ok left and went to location 34567 below and came back
Location:  34567 :
     10010 
Location:  31132 :
     20241 


Instead of: -

Location:  24488 :
     10010 
     10010 
Location:  34567 :
     10010 
Location:  31132 :
     20241 

I cant see whats wrong, is my <if> test suspect?

Regards

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-2011 All Rights Reserved.