I want your help to turn some XML into new using XSLT. I have code for selecting multiple XML and applying XSLT on them.
My problem is with XSLT, where I want to convert these shop1.xml shop2xml .. to allshops.xml. This is not an easy task for those who know how to work with XSLT, because there are only 2-3 changes.
Below you can find structures for a better understanding. Thank you very much.
shop1.xml
<shop> <products> <product id="189"> <title></title> <description></description> <price></price> <image></image> <url></url> <category id="61"></category> </product> </products> </shop>
shop2.xml
<shop> <products> <product id="182"> <title></title> <description></description> <price></price> <image></image> <url></url> <category id="62"></category> </product> </products> </shop>
shop3.xml // it has direct products as root, and id is already present
<products> <product> <id>123</id> <title></title> <description></description> <price></price> <image></image> <url></url> <category id="62"></category> </product> </products>
paths.xml it is used from php code to get multiple xml files
<?xml version="1.0" encoding="utf-8"?> <files> <file>shop1.xml</file> <file>shop2.xml</file> <file>shop3.xml</file> </files>
allshops.xml
<products> //removed the store,shop and products stays as root <product> <id>the product attribute id</id> //new element, with value the product id="" <title></title> <description></description> <price></price> <image></image> <url></url> <category></category> //removed the attribute id <shopid></shopid> //new element, will be blank for now </product> <product> </product> . . . </products>
source share