Page 1 of 1

XML magic / repeating sections

Posted: Wed Sep 22, 2021 4:57 pm
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

Re: XML magic / repeating sections

Posted: Wed Sep 22, 2021 5:06 pm
by ezFlow
This is indeed just why Variable XPath Repeater was created.
https://www.enfocus.com/en/appstore/pro ... able-xpath

Re: XML magic / repeating sections

Posted: Fri Sep 24, 2021 12:01 pm
by magnussandstrom
We are using SAXONICA and XSLT for this kind of operations.

Re: XML magic / repeating sections

Posted: Mon Sep 27, 2021 4:02 pm
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?

Re: XML magic / repeating sections

Posted: Mon Sep 27, 2021 5:16 pm
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.

Re: XML magic / repeating sections

Posted: Fri Oct 01, 2021 11:46 am
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.

Re: XML magic / repeating sections

Posted: Fri Oct 01, 2021 12:04 pm
by matthew.hearne
Managed to do what I needed just using XSLT.

Thanks,
Matt