XML magic / repeating sections

Post Reply
matthew.hearne
Member
Posts: 24
Joined: Thu Dec 19, 2019 3:00 pm

XML magic / repeating sections

Post by matthew.hearne »

We want to generate some XML on the fly for an order type that we get. We can setup a template and use XML magic to populate the majority of this OK.

The problem we have is that the number of "Order Lines" in the XML will be variable. So, there may be one product ordered, or many products.

Below is an example of an XML structure we would have. The "ItemOut" section would need to repeated on the fly depending on how many we need for that specific order. And then we'd need to update the elements in each one (price/quantity etc).

<Request>
<OrderRequest>

There are lots of nodes in this section relating to the order which we can update.

<ItemOut lineNumber="1" quantity="125">
<ItemDetail>
<Description>Product details</Description>
<Price>£10</Price>
</ItemDetail>
</ItemOut>
<ItemOut lineNumber="2" quantity="250">
<ItemDetail>
<Description>Another products details</Description>
<Price>£15</Price>
</ItemDetail>
</ItemOut>
</OrderRequest>
</Request>

Can we use XML magic to do this or would we need a further plugin like Variable XPath Repeater?

Thanks,
Matt
User avatar
ezFlow
Newbie
Posts: 9
Joined: Mon Jun 18, 2018 6:51 pm

Re: XML magic / repeating sections

Post by ezFlow »

This is indeed just why Variable XPath Repeater was created.
https://www.enfocus.com/en/appstore/pro ... able-xpath
User avatar
magnussandstrom
Advanced member
Posts: 345
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: XML magic / repeating sections

Post by magnussandstrom »

We are using SAXONICA and XSLT for this kind of operations.
matthew.hearne
Member
Posts: 24
Joined: Thu Dec 19, 2019 3:00 pm

Re: XML magic / repeating sections

Post by matthew.hearne »

ezFlow wrote: Wed Sep 22, 2021 5:06 pm This is indeed just why Variable XPath Repeater was created.
https://www.enfocus.com/en/appstore/pro ... able-xpath
Do you have an example flow using this that you could share?
User avatar
ezFlow
Newbie
Posts: 9
Joined: Mon Jun 18, 2018 6:51 pm

Re: XML magic / repeating sections

Post by ezFlow »

There is a sample document in the Resource files on the app description page, and the default configuration of the Variable XPath Repeater app works with that sample file.

You can also send your specific file to our support, and we will send you the corresponding flow.
boxclever
Newbie
Posts: 13
Joined: Thu Aug 11, 2016 11:03 am
Location: France

Re: XML magic / repeating sections

Post by boxclever »

Hello
I have to say that Variable Xpath Repeater is a fantastic app. Bought it last year and it has really helped me automate digital press jobs where I have multiple components in the received XML files.
matthew.hearne
Member
Posts: 24
Joined: Thu Dec 19, 2019 3:00 pm

Re: XML magic / repeating sections

Post by matthew.hearne »

Managed to do what I needed just using XSLT.

Thanks,
Matt
Post Reply