Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Splitting XML with Transform

alexr
Level 2
Level 2

I am working on an application to create Work Orders using output. The host application sends a batch of Work Orders in XML format (generated using JFTRANS from the Central Migration). The XML contains the customer number. I use Transform to sort the incoming XML by customer number.The structure of the XML is like this:

<File>

     <Record>

         <Header>

               <custno>1234</custno>

               <wonumber>001234<.wonumber>

               <page>1</page

               .

               .

          </Header>

          <Detail>

               <lineno>1</lineno>

               <itemno>004444</itemno>

               .

               .

          </Detail>

          <Detail>

               <lineno>2</lineno>

               <itemno>005555</itemno>

               .

               .

          </Detail>

          <Header>

               .

          </Header>

          <Detail>

               .

          </Detail>

     </Record>

     <Record>

          .

     </Record>

</File>

I tried to use the "Generate Multiple Streams" option of Output/generatePDFOutput to split the output by customer. Unfortunately, the "Generate Multiple Streams" only offers splitting on a "Record" level, not based on content. I need to generate a separate output file for each customer, which could have multiple Work Orders, each with 1 - n pages.

The Foundation/Transform activity doesn't seem to have the functionality to define an XML split via XSLT.

Has anyone done this before?

Thank you!

1 Accepted Solution
Steve_L_Walker
Correct answer by
Level 10
Level 10

You're welcome Alex.

Since this is a recurring request on the forum I put together the attached PDF. The PDF describes a technique for splitting an XML document using the XSLT service and includes the following attachments: an ES2 .lca, a sample XML document and the XSL included in the process.

If you have any questions or comments please email stwalker.adobe@gmail.com.

Thanks,

Steve

View solution in original post

6 Replies
Steve_L_Walker
Level 10
Level 10

Different XSLT processors, including those that are XSLT 2.0 and Saxon 9 compliant, can split one XML document and write multiple XML documents. While the XSLT Transform operation uses Saxon (I am not sure which version) the DSC is not designed to output multiple results AFAIK.

You would have to use an external process or a custom script to do the split and writes.

Steve

pguerett
Level 10
Level 10

Does each Record node contain a complete document? If so then you should be able to tell Output to create new docs on each Record node.

Paul

alexr
Level 2
Level 2

Thank you Steve. That's what I expected. I "bit the bullet" and wrote my own XML splitter to (a) split the XML and (b) pass a list of the resulting XML files back to the process. It would be nice if LC ES2.5 would let us do the split with the Transform / XSLT Service. 

alexr
Level 2
Level 2

Thank you Paul, unfortunately I can't use the "Generate Multiple Streams" option. The <Record> level could be a new transaction or a "Page n of m" and I need to split on a transaction level. 

Steve_L_Walker
Correct answer by
Level 10
Level 10

You're welcome Alex.

Since this is a recurring request on the forum I put together the attached PDF. The PDF describes a technique for splitting an XML document using the XSLT service and includes the following attachments: an ES2 .lca, a sample XML document and the XSL included in the process.

If you have any questions or comments please email stwalker.adobe@gmail.com.

Thanks,

Steve

View solution in original post

alexr
Level 2
Level 2

Hello Steve,

Thank you very much for this very helpful example and your thorough explanations.

I really appreciate it!