Forum How do I...?

Break into PDF files based on element or attribute?

cull
Using Prince, can I output an XML file into multiple PDFs - breaking into a new PDF file for each new element?

In the following example, I would need to output a separate file for each new <list1_PARTY_ID> element:


<?xml version="1.0"?>
<Report xmlns="Report1" >
<List1>
<list1_PARTY_ID PARTY_ID="BA10314">
<table1>
<Detail_Collection>
<Detail FIRST_NAME="Bart Simpson" POSTAL_ADDRESS="456 Elm Hts" CITY="Canmore " STATE="Alberta" POSTAL_CODE="TiW258" />
</Detail_Collection>
</table1>
</list1_PARTY_ID>
<list1_PARTY_ID PARTY_ID="BA10522">
<table1>
<Detail_Collection>
<Detail FIRST_NAME="Big Bird" POSTAL_ADDRESS="654 Oak St" CITY="Victoria" STATE="BC" POSTAL_CODE="V8V 4Y9" />
</Detail_Collection>
</table1>
</list1_PARTY_ID>
....etc.
mikeday
No, you will need to chop the input file into multiple separate files first and then apply Prince to each one. XSLT 2 or Perl or another scripting language could be used to chop up the file.