I am trying to convert XML file to another XML file using XSLT.
Input file is:
<?xml version="1.0" encoding="UTF-8"?>
<listings>
<listing>
<listingid>4789231</listingid>
<listingtype>Land</listingtype>
<saletype>Sale</saletype>
<originalsource>CBC Online</originalsource>
<sourcekey>4789231</sourcekey>
<cbcofficekey>EDG7023975</cbcofficekey>
<status>Active</status>
<name>7218 Bailey Rd</name>
<address1>7218 Bailey Rd</address1>
<address2></address2>
<address3></address3>
<city>Pearland</city>
<county>Brazoria</county>
<stateprovince>TX</stateprovince>
<postalcode>77584</postalcode>
<country>US</country>
<nearestmsa>Yuba City, CA</nearestmsa>
<baseprice currency="USD">185000.00</baseprice>
<pricetype>saleprice</pricetype>
<displayprice>true</displayprice>
<geolocation>
<latitude>29.5298</latitude>
<longitude>-95.3322</longitude>
</geolocation>
<preferredunitsofmeasure>IMPERIAL</preferredunitsofmeasure>
<displayonwww>true</displayonwww>
<create_ts>2014-06-20T09:09:21Z</create_ts>
<lastmod_ts>2014-06-26T11:53:14Z</lastmod_ts>
<overview>
<propertyoverview>
<buildingarea>3691.00</buildingarea>
<yearbuilt>1960</yearbuilt>
<priceperarea currency="USD">4.99</priceperarea>
</propertyoverview>
</overview>
</listing>
</listings>
Output I want is:
<?xml version="1.0" encoding="UTF-8"?>
<listings>
<listing>
<listingid>4789231</listingid>
<listingtype>Land</listingtype>
<saletype>Sale</saletype>
<originalsource>CBC Online</originalsource>
<sourcekey>4789231</sourcekey>
<cbcofficekey>EDG7023975</cbcofficekey>
<status>Active</status>
<name>7218 Bailey Rd</name>
<address1>7218 Bailey Rd</address1>
<address2></address2>
<address3></address3>
<city>Pearland</city>
<county>Brazoria</county>
<stateprovince>TX</stateprovince>
<postalcode>77584</postalcode>
<country>US</country>
<nearestmsa>Yuba City, CA</nearestmsa>
<baseprice currency="USD">185000.00</baseprice>
<pricetype>saleprice</pricetype>
<displayprice>true</displayprice>
<geolocation_latitude>29.5298</geolocation_latitude>
<geolocation_longitude>-95.3322</geolocation_<longitude>
<preferredunitsofmeasure>IMPERIAL</preferredunitsofmeasure>
<displayonwww>true</displayonwww>
<create_ts>2014-06-20T09:09:21Z</create_ts>
<lastmod_ts>2014-06-26T11:53:14Z</lastmod_ts>
<overview_propertyoverview_buildingarea>3691.00</overview_propertyoverview_buildingarea>
<overview_propertyoverview_yearbuilt>1960</overview_propertyoverview_yearbuilt>
<overview_propertyoverview_priceperarea>4.99</overview_propertyoverview_priceperarea>
</listing>
</listings>
If parent has child nodes then output xml should contain node with parent plus child node name. Here I want parent nodes should be concatenated with child node name according to their hierarchy.