Hi,
I am new to XSL. I don't know how to loop through XML and filter duplicates using XSL. I tried several ways but i could hot get it done. Here is my requirement.

My XML
---------

<?xml version="1.0" ?>
<X12Summary>
<Unit volume="10" Amount="100">
<Identifier Name="Customer ID" Value="12345" />
<Identifier Name="Customer Name" Value="Jones Thomas" />
<?xml version="1.0" ?>
<X12Summary>
<Unit volume="10" Amount="100">
<Identifier Name="Customer ID" Value="12345" />
<Identifier Name="Customer Name" Value="Jones Thomas" />
<Identifier Name="Address" Value="addr1" />
<Identifier Name="City" Value="Atlanta" />
<Identifier Name="Zipcode" Value="10231" />
<Identifier Name="Brand" Value="new" />
<Identifier Name="TimeZone" Value="EST" />
</Unit>
<Unit volume="10" Amount="1000">
<Identifier Name="Customer ID" Value="12345" />
<Identifier Name="Customer Name" Value="Jones Thomas" />
<Identifier Name="Address" Value="addr2" />
<Identifier Name="City" Value="Chicago" />
<Identifier Name="Zipcode" Value="10232" />
<Identifier Name="Brand" Value="old" />
<Identifier Name="TimeZone" Value="EST" />
</Unit>
<Unit volume="10" Amount="1500">
<Identifier Name="Customer ID" Value="12345" />
<Identifier Name="Customer Name" Value="Jones Thomas" />
<Identifier Name="Address" Value="addr3" />
<Identifier Name="City" Value="Dallas" />
<Identifier Name="Zipcode" Value="16232" />
<Identifier Name="Brand" Value="new" />
<Identifier Name="TimeZone" Value="CST" />
</Unit>
<Unit volume="10" Amount="1500">
<Identifier Name="Customer ID" Value="23451" />
<Identifier Name="Customer Name" Value="David Beckley" />
<Identifier Name="Address" Value="addr4" />
<Identifier Name="City" Value="mexico" />
<Identifier Name="Zipcode" Value="15732" />
<Identifier Name="Brand" Value="new" />
<Identifier Name="TimeZone" Value="CST" />
</Unit>
<Unit volume="10" Amount="1520">
<Identifier Name="Customer ID" Value="23451" />
<Identifier Name="Customer Name" Value="David Beckley" />
<Identifier Name="Address" Value="addr5" />
<Identifier Name="City" Value="UAE" />
<Identifier Name="Zipcode" Value="1245125" />
<Identifier Name="Brand" Value="new" />
<Identifier Name="TimeZone" Value="PST" />
</Unit>
</X12Summary> <Identifier Name="Address" Value="addr1" />
<Identifier Name="City" Value="Atlanta" />
<Identifier Name="Zipcode" Value="10231" />
<Identifier Name="Brand" Value="new" />
<Identifier Name="TimeZone" Value="EST" />
</Unit>
<Unit volume="10" Amount="1000">
<Identifier Name="Customer ID" Value="12345" />
<Identifier Name="Customer Name" Value="Jones Thomas" />
<Identifier Name="Address" Value="addr2" />
<Identifier Name="City" Value="Chicago" />
<Identifier Name="Zipcode" Value="10232" />
<Identifier Name="Brand" Value="old" />
<Identifier Name="TimeZone" Value="EST" />
</Unit>
<Unit volume="10" Amount="1500">
<Identifier Name="Customer ID" Value="12345" />
<Identifier Name="Customer Name" Value="Jones Thomas" />
<Identifier Name="Address" Value="addr3" />
<Identifier Name="City" Value="Dallas" />
<Identifier Name="Zipcode" Value="16232" />
<Identifier Name="Brand" Value="new" />
<Identifier Name="TimeZone" Value="CST" />
</Unit>
<Unit volume="10" Amount="1500">
<Identifier Name="Customer ID" Value="23451" />
<Identifier Name="Customer Name" Value="David Beckley" />
<Identifier Name="Address" Value="addr4" />
<Identifier Name="City" Value="mexico" />
<Identifier Name="Zipcode" Value="15732" />
<Identifier Name="Brand" Value="new" />
<Identifier Name="TimeZone" Value="CST" />
</Unit>
<Unit volume="10" Amount="1520">
<Identifier Name="Customer ID" Value="23451" />
<Identifier Name="Customer Name" Value="David Beckley" />
<Identifier Name="Address" Value="addr5" />
<Identifier Name="City" Value="UAE" />
<Identifier Name="Zipcode" Value="1245125" />
<Identifier Name="Brand" Value="new" />
<Identifier Name="TimeZone" Value="PST" />
</Unit>
</X12Summary>

Output should be in HTML table
------------------------------------
12345 - Jones Thomas

Address City Zipcode Brand TimeZone Amount
addr1 Atlanta 10231 new EST 100
addr2 Chicago 10232 old EST 1000
addr3 Dallas 16232 new CST 1500


23451 - David Beckley

Address City Zipcode Brand TimeZone Amount
addr4 mexico 15732 new CST 1500
addr5 UAE 1245125 old PST 1520

Can anyone please help me to get XSL for this. Thanks in advance.

Hey there,
I hope you have solved your problem already. But just in case you haven't, I thought I'd reply.

I am very new to XML, but I think you have some problems in your code. You open and close your X12Summary twice within the code.

As far as extracting unique elements from your xml file, google for XML unique and I believe you will be able to find a solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.