#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    1
    Rep Power
    0

    XML to HTML using XSL


    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 like this
    ------------------------------------
    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.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    13
    Rep Power
    0

    XML to HTML using XSLT without Hardcoding Node names in XSLT


    Hi All,

    I am new to XML,XSLT. I have been assigned to task of Generating HTML pages based on the XML file & the condition is No Hardcoding of Nodes and other details.

    My XML file is of the below struct:

    Node inside Nodes , and those nodes would contain any number of attribuites or elements.


    Now i need to knw , is there any Generic XSLT Algorithm to can do the above job and render the HTML page in the form of Navigation Tabs?

    Please advice...

    web development services | Web development company

IMN logo majestic logo threadwatch logo seochat tools logo