xsl-list
[Top] [All Lists]

Re: Selecting multi-existant elements only once

2002-11-25 10:15:40
Your problem is to print unique nodes.
You could do that the way you found out yourself or make use of keys , which
is more efficient.
Refer to the articles at Jeni's Page

http://www.jenitennison.com/xslt/grouping/index.html

HTH
Vasu
----- Original Message -----
From: "Sorin Marti" <mas(_at_)semafor(_dot_)ch>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Monday, November 25, 2002 3:30 PM
Subject: Re: [xsl] Selecting multi-existant elements only once


I've got the solution...sorry for asking...

 <xsl:for-each
select="//departement/profession[not(desc=preceding::desc)]">
   <xsl:value-of select="desc"/>
  </xsl:for-each>

Sorin Marti

I wrote:

Hi all,

I've got a XML-File with following structure. There are different
departements and in each departement there are different professions.
I want to have every profession of all departement once... If there is
a Manager in departement a and departement b, "Manager" should only be
printed out once...

How can I do that?

[...]
<departement>
 <profession>
   <desc>Manager</desc>
   <salary>5000</salary>
 </profession>

 <profession>
   <desc>Assistant</desc>
   <salary>3000</salary>
 </profession>

 <profession>
   <desc>Employee</desc>
   <salary>2000</salary>
 </profession>
</departement>

<departement>
 <profession>
   <desc>Manager</desc>
   <salary>5000</salary>
 </profession>

 <profession>
   <desc>Worker</desc>
   <salary>2000</salary>
 </profession>
</departement>

[...]

Thanks for your help !

Sorin


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






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


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