Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT & XML

Status
Not open for further replies.

asraj16

Programmer
May 15, 2004
19
US
Hi,
I am generating XML randomly and assigning this XML to a string variable. I need to merge the XMLs one by one. For Example I get the following XML in the first iteration.

<?XML version="1.0"?>
<test>
<test1>
<test2></test2>
<test3></test3>
</test1>
</test>

I am assigning this XML to a string variable.
In the Second iteration, I get the same XML. I need to merge these XMLs to the first XML. How to do that? Is there any way to do this?

Thanks
 
I can able to group all the XMLs. But when I load that XML, I am getting an error because XML is not in the Correct format.

XML1: <?xml version="1.0"?>
<XML>
<row>
<ContainerId>ProdCommStmt</ContainerId>
<RepositoryId>DEV_IS</RepositoryId>
<ContentId>516038</ContentId>
<EmployeeNumber>1000294852</EmployeeNumber>
<ReportID>0000100</ReportID>
<CompanyCode>034</CompanyCode>
<DocumentDate>7/12/2004</DocumentDate>
<F_entrydate>6/23/2004</F_entrydate>
<AgentNumber>PA009</AgentNumber>
</row>
<row>
<ContainerId>ProdCommStmt</ContainerId>
<RepositoryId>DEV_IS</RepositoryId>
<ContentId>516039</ContentId>
<EmployeeNumber>1000294853</EmployeeNumber>
<ReportID>0000100</ReportID>
<CompanyCode>034</CompanyCode>
<DocumentDate>7/12/2004</DocumentDate>
<F_entrydate>6/23/2004</F_entrydate>
<AgentNumber>PA008</AgentNumber>
</row> </XML>

XML 2:


<?xml version="1.0"?>
<XML>
<row>
<ContainerId>ProdCommStmt</ContainerId>
<RepositoryId>DEV_IS</RepositoryId>
<ContentId>516038</ContentId>
<EmployeeNumber>1000294852</EmployeeNumber>
<ReportID>0000100</ReportID>
<CompanyCode>034</CompanyCode>
<DocumentDate>7/12/2004</DocumentDate>
<F_entrydate>6/23/2004</F_entrydate>
<AgentNumber>PA009</AgentNumber>
</row>
<row>
<ContainerId>ProdCommStmt</ContainerId>
<RepositoryId>DEV_IS</RepositoryId>
<ContentId>516039</ContentId>
<EmployeeNumber>1000294853</EmployeeNumber>
<ReportID>0000100</ReportID>
<CompanyCode>034</CompanyCode>
<DocumentDate>7/12/2004</DocumentDate>
<F_entrydate>6/23/2004</F_entrydate>
<AgentNumber>PA008</AgentNumber>
</row> </XML>

When I concat these two XMLs in one string and assigning to a string variable, not able to load this because, I need all the row tags in one XML tag and there should be only one
<?xml version="1.0"?> in the entire XML.

Thanks
Raj

 
So, take out the tags you don't want.

I would suggest you research the various XSLT string functions. In fact, a web search with "XSLT string functions" might be worthwhile.



Thomas D. Greer
Providing PostScript & PDF
Training, Development & Consulting
 
I need to merge two XMLs into one XML.
 
Yes, you mentioned that. What is it about my advice that you don't like?



Thomas D. Greer
Providing PostScript & PDF
Training, Development & Consulting
 
I checked XSLT string functions. But I am getting the XML but not in the correct format.
 
There is no simple way to do what you want. You have to program it. You program it by using XLST's string functions to manipulate your strings until you get the desired result.



Thomas D. Greer
Providing PostScript & PDF
Training, Development & Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top