Hi Npselval,

Is it impossible for you to use the exslt.org extensions (they are part of xalan you should just declare the namespace).
They contain an implementation of the distinct function. Example:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
   xmlns:set="http://exslt.org/sets";>

<xsl:variable name="uniquevalues"
select="set:distinct(/validation/report/script/case/@name)"
/>

...


Best regards
Christoffer Dam Bruun

enpysoft skrev:
Hi Experts,
          I have to get the list of the distinct attribute values across
different node level. To help you understand my requirement, i am herewith
listed with a sample XML file

My XML file looks like this

<validation>
 <report>
   <script city="NY">
          <case name="ramesh" status="BE"/>
          <case name="rajesh" status="B.Com" />
   </script>
   <script city="AL">
          <case name="ramesh" status="Law" />
   </script>
 </report>
</validation>

Now i have to get only the values as ramesh and rajesh and i should not get
ramesh two times. As i use only XPATH 1.0 and XSLT 1.0 i cannot use
distinct-values function. I earlier tried using to fetch distinct values to
a variable using the below script in xslt and it is not working.

<xsl:variable name="uniquevalues"
select="/validation/report/script/case[not(@name=predicate-sibling::validation/report/script/case/@name)]/@name"
/>

The above code snippet is not working. Kindly let me know what has to be
done to get my expected output.


thanks in advance,
npselvan

Reply via email to