473,394 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

distinct values of xml

Hi All!
I need your help. I have XML with structure like this:
<dataset>
<node><category>C1</category><desc>D1</desc></node>
<node><category>C2</category><desc>D2</desc></node>
<node><category>C1</category><desc>D1</desc></node>
<node><category>C3</category><desc>D3</desc></node>
...
</dataset>

I want distinct <category> and <desc> values in the kind:

C1_D1
C2_D2
C3_D3
Thanks in advance for any help.
Eugene

Sep 22 '05 #1
1 1108
Hi,

Tempore 10:08:36, die Thursday 22 September 2005 AD, hinc in foro {comp.text.xml} scripsit Eugen <el******@web.de>:
I want distinct <category> and <desc> values in the kind:
C1_D1
C2_D2
C3_D3


In XSLT 1.0 , it's common practice to approach this as a standard grouping problem, which in it's turns is easily tackled with the Muenchian technique.

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>

<xsl:key name="node" match="node" use="concat(category,'_',desc)"/>

<xsl:template match="dataset">
<xsl:for-each select="node[generate-id()=
generate-id(key('node',concat(category,'_',desc))[1])]">
<xsl:value-of select="concat(category,'_',desc)"/>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>
regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
«Error, keyboard not found— press F1 to continue» , BIOS
Sep 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Florian | last post by:
Hi, I have a table that contains log data, usually around a million records. The table has about 10 columns with various attributes of the logged data, nothing special. We're using SQL Server...
8
by: Richard | last post by:
This is probably easy but I can't work it out. I have this statement SELECT DISTINCT TOP 100 PERCENT dbo.CIF_PlaceReference.Name FROM dbo.CIF_Departures INNER JOIN dbo.CIF_PlaceReference...
8
by: Rich | last post by:
My table looks like this: char(150) HTTP_REF, char(250) HTTP_USER, char(150) REMOTE_ADDR, char(150) REMOTE_HOST, char(150) URL, smalldatetime TIME_STAMP There are no indexes on this table...
5
by: Fred Zuckerman | last post by:
Can someone explain the difference between these 2 queries? "Select Distinct id, account, lastname, firstname from table1" and "Select DistinctRow id, account, lastname, firstname from table1" ...
7
by: Johnathan Doe | last post by:
I can google search to find the range of values that can be represented in a float by reading up on the IEEE std, but is that the same as how many distinct values that can go in a float type? ...
1
by: perspolis | last post by:
Hi everybody is it possible to use Distict sql in DataTable.or DataView.. for example dt.DefaultView.RowFilter="Distinct Code"; ??
5
by: sdowney717 | last post by:
from this, circdate being a datetime field: SQLQuery = "select distinct circdate from circdata order by circdate" I need the distinct date portion excluding the time part. this has come about...
5
by: Daniel Wetzler | last post by:
Dear MSSQL experts, I use MSSQL 2000 and encountered a strange problem wqhile I tried to use a select into statement . If I perform the command command below I get only one dataset which has...
1
newnewbie
by: newnewbie | last post by:
Desperately need help in creating a query to count unique values in a table. I am a Business analyst with limited knowledge of Access….My boss got me ODBC connection to the underlying tables for our...
3
by: Yogesh Sharma | last post by:
I want to select that rollnos which have distinct name & address. create table studento(roll int,name varchar,address varchar(5)) insert into studento values(1,'A','ADD1') insert into studento...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.