473,386 Members | 1,753 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,386 software developers and data experts.

removing/combining doubles in xml

Hey,

I have generated following xml file (using perl,dbi),

Now I would like to display this with the help of xsl

such that I have the following result:

A B (XXXX) (YYYY)

Can someone help me with that?

Thanks

Here is the xml file

<List_personnel>

<select>

<Personnel_member>

<person_id>224</person_id>

<name>A</name>

<first_name>B</first_name>

<team_code>XXXX</team_code>

</Personnel_member>

<Personnel_member>

<person_id>224</person_id>

<name>A</name>

<first_name>B</first_name>

<team_code>YYYY</team_code>

</Personnel_member>

</select>

</List_personnel>



Jul 20 '05 #1
1 1410
> I have generated following xml file (using perl,dbi),

Now I would like to display this with the help of xsl

such that I have the following result:

A B (XXXX) (YYYY)

Can someone help me with that?


Hi,
In XSLT 1.0, there is no standard way to do that task, but you can use e.g. generate-id() in combination with key() , to obtain a result. Another way is to use extension functions.
This is a possible solution:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>

<xsl:key name="p_id" match="Personnel_member" use="person_id"/>

<xsl:template match="select">
<xsl:for-each select="Personnel_member[ generate-id(.) = generate-id(key('p_id',person_id))]">
<xsl:apply-templates select="name"/>
<xsl:apply-templates select="first_name"/>
<xsl:apply-templates select="../Personnel_member[person_id=current()/person_id]/team_code"/>
</xsl:for-each>
</xsl:template>

<xsl:template match="team_code">
(<xsl:value-of select="."/>)
</xsl:template>

</xsl:stylesheet>

regards,

--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
Jul 20 '05 #2

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

Similar topics

6
by: simon place | last post by:
Removing __slots__ ~~~~~~~~~~~~~~~~~~~ To do this nicely requires the renaming of __dict__ to, say, __attribs__ , ( since dict is unnecessarily unspecific, this seem like a small improvement...
2
by: Chris Mullins | last post by:
I've spent a bit of time over the last year trying to implement RFC 3454 (Preparation of Internationalized Strings, aka 'StringPrep'). This RFC is also a dependency for RFC 3491...
35
by: Geronimo W. Christ Esq | last post by:
Are there any scripts or tools out there that could look recursively through a group of C/C++ source files, and allow unreferenced function calls or values to be easily identified ? LXR is handy...
15
by: Phillip Rhodes | last post by:
Hi all, I have a question I hope someone can help me with: I'm doing some communication over a socket, and have need to send and receive values of type double. I'm doing everything in terms of...
7
by: Barry | last post by:
Hi all, I've noticed a strange error on my website. When I print a capital letter P with a dot above, using & #7766; it appears correctly, but when I use P& #0775 it doesn't. The following...
8
by: Charlie Zender | last post by:
Hi, First, this may be a GCC or Linux-specific problem, I'm not sure. I am unable to compile a large body of code with extremely pedantic compile time checks activate, so that warnings cause...
5
by: Tales Normando | last post by:
The title says it all. Anyone?
7
by: Adam Honek | last post by:
Is there a direct way to remove one entry from a one dimensional array? I keep looking but either my eyes are funny or it isn't there. Must we really create a temp array and copy all but 1 of...
6
by: Niyazi | last post by:
Hi all, What is fastest way removing duplicated value from string array using vb.net? Here is what currently I am doing but the the array contains over 16000 items. And it just do it in 10 or...
5
by: Tristan Miller | last post by:
Greetings. Is it possible using HTML and CSS to represent a combining diacritical mark in a different style from the letter it modifies? For example, say I want to render Å‘ (Latin small letter...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.