• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do i obtain unique value thru this code

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With DOM, SAX, XSL ?
 
clyde mel
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
with xsl or sax
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic