I am working on simple Switch flow for vdp using new barcode action from PitStop Server.
I have incoming xml with barcode values, I inject template pdf and needed barcode is generated by PS perfectly. No problems with this part.
But I find it really difficult to split incoming xml into several xml files named by barcode values. Could xsl transform do the job?
One option is to use csv and CSV2XML app from appstore instead but I would like to solve it without additional tools.
Can anyone guide me how to split xml without serious scripting or using additional tools?
Sample of xml I am using:
<field-list>
<field>
<tag>barcode</tag>
<type>string</type>
<required>true</required>
<value>01-01-01</value>
</field>
<field>
<tag>barcode</tag>
<type>string</type>
<required>true</required>
<value>01-02-01</value>
</field>
<field>
<tag>barcode</tag>
<type>string</type>
<required>true</required>
<value>01-03-01</value>
</field>
<field>
<tag>barcode</tag>
<type>string</type>
<required>true</required>
<value>01-04-01</value>
</field>
</field-list>
Split XML
Re: Split XML
You can use Saxon with a xslt transform to split the xml.
Re: Split XML
I have made an App called Excel to XML. In the documentation of this app there is an example XSLT that will help you create an XSLT for Saxonica that will split your XML to single ones per record.
https://www.enfocus.com/en/appstore/pro ... cel-to-xml
https://www.enfocus.com/en/appstore/pro ... cel-to-xml
-
- Newbie
- Posts: 6
- Joined: Tue Jun 19, 2018 10:52 pm
Re: Split XML
Thanks vernonvd, Freddy and Jan, Saxon did the job perfectly.
I will test your app as well Jan, I already got a trial.
I will test your app as well Jan, I already got a trial.
-
- Newbie
- Posts: 5
- Joined: Sat Jun 30, 2018 6:08 am
Re: Split XML
Do you have an example of the xslt code you used? I have a very similar project and have not been able to find a solution. I am using the built in xslt tool in switch, is there a reason to use saxon over the build in tool?
Re: Split XML
Yes the Saxonica uses XSLT 2.0 and the built in only uses XSLT 1.0. Enfocus decided that it was better to use a third party well established solution than to develop its own that could handle XSLT 2.0.