473,732 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT selecting unique records

17 New Member
How do you select unique records?
For example, if my data is like the following and I only want the repeated data (address information) to appear once for each theater_id.
<xsl:for-each select="Table"> ????



<Table>
<device_id>26 </device_id>
<serial_number> 200102</serial_number>
<is_active>true </is_active>
<commission_dat e>2006-01-10T00:00:00-05:00</commission_date >
<theater_id>000 00056</theater_id>
<theater_name>U ltra Star La Costa 6</theater_name>
<street_address 1>6941 El Camino Real</street_address1 >
<street_address 2 />
<street_city>Ca rlsbad</street_city>
<street_state>C A </street_state>
<street_zip_cod e>92009-4108</street_zip_code >
<street_country _id>USA</street_country_ id>
<screen_no>1</screen_no>
</Table>
<Table>
<device_id>27 </device_id>
<serial_number> 200713</serial_number>
<is_active>true </is_active>
<commission_dat e>2006-01-10T00:00:00-05:00</commission_date >
<theater_id>000 00056</theater_id>
<theater_name>U ltra Star La Costa 6</theater_name>
<street_address 1>6941 El Camino Real</street_address1 >
<street_address 2 />
<street_city>Ca rlsbad</street_city>
<street_state>C A </street_state>
<street_zip_cod e>92009-4108</street_zip_code >
<street_country _id>USA</street_country_ id>
<screen_no>1</screen_no>
</Table>
Jul 23 '07 #1
3 4134
jkmyoung
2,057 Recognized Expert Top Contributor
http://www.jenitenniso n.com/xslt/grouping/muenchian.html

The easiest way would be something like:
<xsl:for-each select="Table[not (theater_id = previous-sibling::Table/theater_id)]">

A more efficient way would involve use of keys, see the link provided.
Jul 23 '07 #2
IsValidUN
17 New Member
Thanks!
I already tried your recommendation and it works.
I also looked at using the "keys" method but can't get it to work. I'll keep trying.
Jul 24 '07 #3
jkmyoung
2,057 Recognized Expert Top Contributor
Would look something like this:
<xsl:for-each select="Table[count(. | key('TableByThe aterid', theater_id)[1]) = 1]">
Jul 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1831
by: Chris Kettenbach | last post by:
Hi Peter, I get error when processing the stylesheet. It errors here. <xsl:for-each select="registration)=1]"> specifically: Expression does not return a DOM node. registration)=1]<--
8
2225
by: Henrik Larsson | last post by:
Hi, I need help with selecting the following rows from a table looking like this: ID IP Query 1 -> 1 2.2.2.2 (ie first IP 1 1.1.1.1 <- Query 2 for each ID) 1 3.3.3.3 (ie second IP for each ID) -> 2 5.5.5.5 2 6.6.6.6 <-
0
1846
by: allyn44 | last post by:
HI--I have 2 tables Cut: cut ID, HistNumb, Block, date: Cut Id is the primary key, the other 3 fileds are indexed to be unique Slides: Cutid SlideID, and various other fields: there can be multiple slide records per CutID. This table is a subdatashet of the Cut table--so the CutId is stored in it I have a form based on a query between the 2 tables for adding slide records
48
3866
by: phillip.s.powell | last post by:
MySQL 3.23.58 - 4.0.17 (yep, several database server instances, don't ask) I have database Spring with table Students I have database Summer with table Students I am tasked to produce a query of all students in both tables with no duplicates. No clue whatsoever.
2
3333
by: Catch_22 | last post by:
Hi, I have a stored procedure that has to extract the child records for particular parent records. The issue is that in some cases I do not want to extract all the child records only a certain number of them. Firstly I identify all the parent records that have the requird number of child records and insert them into the result table.
1
3655
by: Daniel Hilgarth | last post by:
Hello, I am currently trying to use XSLT for the creation of multiple HTML-files from a single XML-File. This HTML-files need to have links to each other. The following information might be important: There are some special nodes that will start a new HTML-page ("page-nodes"). Those nodes can be nested. Those nodes have an attribute "name" which is not necessarily unique. There are another special nodes that will create a link in one...
1
4746
by: balderdash | last post by:
Hi I am very close to achieving the output I need but I cant seem to get it right. The problem is I am looping through a table and selecting values, if there are 2 values per (row) Issuer I need to put a slash between them in the output xml. The problem is shown by the output at the bottom of this post. I am
3
9606
by: super.raddish | last post by:
Greetings, I am relatively new to, what I would call, advanced XSLT/XPath and I am after some advice from those in the know. I am attempting to figure out a mechanism within XSLT to compare the difference between two source documents and output node-sets which are "different" (changed or new) to new XML files using xsl:result-document To describe the problem I have provided some example data below along with my a portion of my current...
1
4368
by: sakhawn | last post by:
hi all, I need to transform an xml file into a different format (Dublin Core schema) using xslt, file contains different records each record needs to transformed based on a unique ID (in this case its element <guid>) that represents the record. Input file is: <?xml version="1.0" encoding="UTF-8" ?> <ListRecords> <record> <header> <identifier>Project_DEM_100</identifier> <datestamp>2000-02-14T09:23:25Z</datestamp> </header>
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9307
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9235
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.