<Company> <Employee> <EmpID>1</EmpID> <EmpName>XXX</EmpName> <EmpSal>5000</EmpSal> <EmpID>2</EmpID> <EmpName>YYY</EmpName> <EmpSal>6000</EmpSal> </Employee> </Company> But the html output should be in a table like: EmpIDEmpNameEmpSal 1XXX5000 2YYY5000 Here there is no possibility of doing <xsl:for-each> The xml structure should not be changed. So is there is a way to do the transformation. Pls Help. Thanks in advance, Chandru
Chandra The XML fragment that you posted makes absolutely no sense. How can a single employee have multiple names and salaries ? I suggest that you go back to the source of the XML and get it written rather than attempting to apply patched solutions to something that is inherently broken.
Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
Joined: Jul 03, 2002
Hi Andy, consider that i have the xml like this <Company> <Employees> <EmpID>1</EmpID> <EmpName>XXX</EmpName> <EmpSal>5000</EmpSal> <EmpID>2</EmpID> <EmpName>YYY</EmpName> <EmpSal>6000</EmpSal> </Employees> </Company> The employees tag has all the list of employees.
Dear Chandru, In the key Employees root tag you need to have Employee tag which encloses all the details like ID,name etc.. But having the employee tag in employees makes sense.. Just check the structure of you XML again. Cheers, Gaya3
Dear Chandru, Consider reformatting your xml like this; <Company> <Employees> <Employee> <EmpID>1</EmpID> <EmpName>XXX</EmpName> <EmpSal>5000</EmpSal> </Employee> <Employee> <EmpID>2</EmpID> <EmpName>YYY</EmpName> <EmpSal>6000</EmpSal> </Employee> </Employees> </Company>
Joined: Jul 03, 2002
Hi, First thanx everyone for the reply.Iam working on a project for a financial domain.In my project we are interfacing with an old legacy application for getting some data.That application sends data in XML format which is similar to the XML that i posted.So in my project i have to parse that XML and show it using JSP's. The legacy application is already existing and it is hard to change the structure of that XML. Thanks & Regards, chandru
Joined: Jun 25, 2003
Dear Chandru, I happened to work on a similar project and what I employed for my project was.. I kept a count of the tags which are common for all the employees(ID,name,salary etc..)and I kept a counter when I was parsing the xml file and when ever the count was divisible by the count of common tags for each employee I wrapped it up in <employee> and after the # of count tags I enlcosed the data with </employee> By this I ensured that the structure of the data is contained (which lacks in the Legacy system) and then you have lot of flexibility to do whatever u want. Cheers, Gaya3