Transform One XML to Multiple XML Files

Post Reply
JohnnyMoss
Newbie
Posts: 5
Joined: Sat Jun 30, 2018 6:08 am

Transform One XML to Multiple XML Files

Post by JohnnyMoss »

I am in need of a way to transform one xml file with multiple nodes that have the same name and convert each of the those nodes into individual xml files for each node.

Here is a sample of the xml. I have been trying to use the built in XSLT tool but am not familiar enough with how it works.

<order>
<product_details>
<items>
<orders_products_id>37</orders_products_id>
<products_name>20180629075817</products_name>
<products_title>Printed SEG</products_title>
<products_sku>EZF</products_sku>
<products_price>316.66666666667</products_price>
<products_quantity>1</products_quantity>
<template_type>Upload Center</template_type>
<features_details>
<option title="I">I</option>
<option title="defining" />
<option title="Width (Inch)">80</option>
<option title="Height (Inch)">95</option>
<option title="Fabric">BaseTex (general use)</option>
<option title="Finishing">Gasket Edge</option>
<option title="Gasket">12mm x 2.5mm</option>
</features_details>
<print_ready_files>
<file>18_50_130x95.pdf</file>
</print_ready_files>
<productsize><b>80</b> Width x <b>95</b> Height <span class="text-danger"> (Inch)</span></productsize>
<csv_file_name />
<products_weight>22.800000</products_weight>
<inventory_storage_days />
<shipping_company />
<tracking_number />
<li_number>1571460</li_number>
</items>
</product_details>
</order>
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Transform One XML to Multiple XML Files

Post by Padawan »

The built in XSLT tool only supports version 1.0, you will need XSLT 2.0 to be able to split XML files. This means that you will need to install Saxon and use the Saxon configurator. If your XSLT is correct, then it will work with Saxon :)
JohnnyMoss
Newbie
Posts: 5
Joined: Sat Jun 30, 2018 6:08 am

Re: Transform One XML to Multiple XML Files

Post by JohnnyMoss »

Thank you for your reply. After much trial and error I was able to achieve the output I wanted.
Post Reply