You Can Try this
I have Considered the following Source XML
<root>
<position>
<id> 1 </id>
<title> ABC <title>
<company> PQR <company>
</company></company></title></title></position>
</root>
And Target XML as
<root>
</root>
Code Goes Here
XmlDocument xDoc = new XmlDocument();
XmlDocument xDoc2 = new XmlDocument();
xDoc.Load(HttpContext.Current.Server.MapPath("menu.xml");
xDoc2.Load(HttpContext.Current.Server.MapPath("menu1.xml");
XmlNode Page = null;
string[] str = {"id","title","company"}
XmlNode Data = xDoc2.CreateNode(XmlNodeType.Element,"position",null);
for(int i = 0 ; i < 3 ; i++)
{
Page = xDoc.SelectSingleNode("position/" + str[i]);
XmlAttribute item = xDoc2.CreateAttribute(str[i]);
item.Value = Page.InnerText;
Data.Attributes.Append(item);
xDoc2.DocumentElement.AppendChild(Data);
}
xDoc2.Save(HttpContext.Current.Server.MapPath("menu1.xml");
Your OutPut will be
<root>
<position id=1 title=ABC company=PQR />
</root>