I have 3 different XML files. Some columns of them common and someone are not. And ordinalPosition of them are changing. Each time, i get new file in my ftp and need to read one by one and load into system. But i don't know about column names of the file.
XML 1 :
<?xml version="1.0" encoding="UTF-8"?>
<SourceFile>
<Data>
<CustNo>126</CustNo>
<Gender/>
<isActive>0</isActive>
<Email/>
</Data>
</SourceFile>
XML 2 :
<?xml version="1.0" encoding="UTF-8"?>
<SourceFile>
<Data>
<CustNo>124</CustNo>
<Phone/>
<Country/>
<isActive>1</isActive>
</Data>
</SourceFile>
XML 3:
<?xml version="1.0" encoding="UTF-8"?>
<SourceFile>
<Data>
<KeyId>123</KeyId>
<FirstName/>
<LastName/>
<Email/>
<isActive>0</isActive>
</Data>
</SourceFile>
I am very new with XSLT. I want generate below output whenever a file arrived in my ftp.
Result for XML 1 :
<?xml version="1.0" encoding="UTF-8"?>
<SourceFile>
<Data>
<KeyID>124</KeyID> <!-- CustNo will be mapped to KeyId -->
<FirstName/>
<LastName/>
<Email/>
<Phone/>
<Country/>
<isActive>0</isActive>
</Data>
</SourceFile>
Many thanks, Mehmet
Assuming that you always want to have all the listed elements present in the output (populated or not), and that you want them in the given order, you could do:
XSLT 1.0