I am using xslt 1.0 My input xml is as below

<?xml version="1.0" encoding="UTF-8"?>
<Employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<FirstName>John</FirstName>
<LastName>Peter</LastName>
<Initial>T</Initial>
<Spouse>
<FirstName>Rita</FirstName>
<LastName>Hudson</LastName>
</Spouse>  
</Employee>

I an trying to write a xsl to produce below output...

<?xml version="1.0" encoding="UTF-8"?>
<ArrayOfstringVariable xmlns="http://schemas.abc.org/2004/07/"       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<stringVariable>
<name>ServerName</name>
<value>tmn.eu.com</value>
</stringVariable>
<stringVariable>
<name>EmpFirstName</name>
<value>John</value>
</stringVariable>
<stringVariable>
<name>EmpLastName</name>
<value>Peter</value>
</stringVariable>
<stringVariable>
<name>SpouseFirstName</name>
<value>Rita</value>
</stringVariable>
<stringVariable>
<name>SpouseLastName</name>
<value>Hudson</value>
</stringVariable>
</ArrayOfstringVariable>

The output xml contains ArrayOfstringVariable stringVariable name value pair.. The name is hardcoded and the value is from input xml.. Name value "ServerName" is hardcoded.

Can anyone help me to write xsl to produce above output?

Thank you

This article has been dead for over six months. Start a new discussion instead.