| Author |
How do i obtain unique value thru this code
|
clyde mel
Greenhorn
Joined: Mar 05, 2002
Posts: 22
|
|
The xml file is given below.How do I retrieve the name value(unique). so the output should be Minnie Donald duck Pluto <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="mock2test.xsl"?> <HumanResources> <Employee department="Personal"> <Name>Minnie</Name> <Age>20</Age> <Sex>Female</Sex> <Salary>3500USD</Salary> </Employee> <Employee department="Finance"> <Name>Donald Duck</Name> <Age>45</Age> <Sex>Male</Sex> <Salary>6000USD</Salary> </Employee> <Employee department="IT"> <Name>Pluto</Name> <Age>22</Age> <Sex>Male</Sex> <Salary>4500USD</Salary> </Employee> <Employee department="IT"> <Name>Donald Duck</Name> <Age>25</Age> <Sex>Male</Sex> <Salary>4000USD</Salary> </Employee> </HumanResources>
|
Just believe in yourself...
|
 |
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
|
|
|
With DOM, SAX, XSL ?
|
SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
|
 |
clyde mel
Greenhorn
Joined: Mar 05, 2002
Posts: 22
|
|
|
with xsl or sax
|
 |
Vasudha Deepak
Ranch Hand
Joined: Mar 15, 2002
Posts: 86
|
|
This works well with the XML file and retreives unique values. <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl utput method="xml" /> <xsl:template match="/"> <EmployeeName> <xsl:for-each select="/HumanResources/Employee/Name[not(.=preceding::Name)]"> <Name><xsl:value-of select="."/></Name> </xsl:for-each> </EmployeeName> </xsl:template> </xsl:stylesheet> Refer http://www.eggheadcafe.com/articles/20010508.asp for details. Hope this helps. Vasudha
|
IBM Certified Developer -XML and Related Technologies(141)<br />SCJP2 SCWCD
|
 |
 |
|
|
subject: How do i obtain unique value thru this code
|
|
|