Skip navigation
alexr@protech
Currently Being Moderated

Splitting XML with Transform

Jul 28, 2010 5:14 AM

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!

 
Replies
  • Currently Being Moderated
    Jul 28, 2010 11:56 AM   in reply to alexr@protech

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 29, 2010 4:56 AM   in reply to Steve L Walker

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 29, 2010 10:01 PM   in reply to alexr@protech

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points