[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Format & display from two xml files


Subject: [xsl] Format & display from two xml files
From: "Sindigi, Ganesh K" <SindiGK@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 24 Dec 2003 14:49:13 -0700

Hello,

I have two xml documents, first one contains titles/headers  
for the data in second file.  
The first file contains order in which data/fields needs to be displayed. 
 I have no control on the both of the input sources.
The size of data file could be in 10s of MB.

The data needs to be shown as HTML table format with headers 
& orders from first file.  
This table could contain nested tables which is determined by 
attribute rowCount of element fieldGroup.

I need to come up with an XSL to achieve both 
- have control on alignment of html-tables
- have control on order of data displayed

I am finding it difficult to align the titles columns with the data
displayed.  
All the column headers are coming in first data column and subsequent data 
columns do not have headers, as these two are formed from two different 
sources and html-tables inside a td are not able to align with subsequent
data td's.

Please suggest me how I could achieve this. 

Thanks,
Ganesh.

Here is XML titles document, source1:

<?xml version="1.0" encoding="UTF-8"?>
<customerList>
   <customer>
      <field> <id>customerId</id> <title>Customer Id</title> </field>
      <field> <id>customerName</id> <title>Customer Name</title></field>
      <fieldGroup rowcount="1">
         <id>homeAddress</id> <title>Home Address</title>
         <fieldList>
            <field> <id>street</id> <title>Street</title> </field>
            <field> <id>city</id> <title>City</title> </field>
         </fieldList>
      </fieldGroup>
      <fieldGroup rowCount="n">
         <id>companyAddress</id> <title>Company Address</title>
         <fieldList>
            <field> <id>street</id> <title>Street</title> </field>
            <field> <id>city</id> <title>City</title> </field>
         </fieldList>
      </fieldGroup>
   </customer>
</customerList>


Here is XML data document, source2:

<?xml version="1.0" encoding="UTF-8"?>
<customerList>
   <customer>
      <field> <id>customerName</id> <value>Customer 1</value></field>
      <field> <id>customerId</id> <value>cust1</value> </field>
      <fieldGroup>
         <id>homeAddress</id>
         <fieldList>
            <field> <id>street</id> <value>98th Street </value></field>
            <field> <id>city</id> <value>Chicago</value></field>
         </fieldList>
      </fieldGroup>
      <fieldGroup>
         <id>companyAddress</id>
         <fieldList>
            <field> <id>street</id> <value>128th Street</value></field>
            <field> <id>city</id> <value>Chicago</value></field>
         </fieldList>
      </fieldGroup>
      <fieldGroup>
         <id>companyAddress</id>
         <fieldList>
            <field> <id>street</id> <value>16th Street</value></field>
            <field> <id>city</id> <value>NY</value></field>
         </fieldList>
      </fieldGroup>
   </customer>...
</customerList>

Desired Output html:

----------------------------------------------------------------------------
-
Customer Id	Customer Name	  Home Address		  Company Address

					Street      City
Street     	City
----------------------------------------------------------------------------
-
cust1		Customer 1		98thStreet Chicago 	128th Street
Chicago
	
---------------------
									16th
Street   NY
----------------------------------------------------------------------------
-
cust2		Customer 2		98thStreet Chicago 	128th Street
Chicago
	
---------------------
									16th
Street   NY
	
---------------------
									16th
Street   NJ

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords