Example: Creating a Simple DAL Job

Top Previous Topic Next Topic  Print this topic

Creating a New DAL Job

 

Every DAL job should have the xfj:output element defined to specify the output format. If it's omitted, then the output will be PDF.

 

This is how the file should look:

 

<?xml version="1.0" encoding="utf-8"?>

<xfj:job xmlns:xfj="http://www.ecrion.com/xfj/1.0">

       <xfj:output mime-type="application/pdf"/>

</xfj:job>

 

Adding Some Documents

 

The primary role of DAL is document assembly, so it's only natural that this first example shows how to merge two documents.

 

The first document is a static PDF file called InputPDF.pdf:

 

 

The second is a dynamic document generated from an XML file with an XFD style-sheet: data.xml with InputXFD.xfd. The rendered output looks like this:

 

 

We will use an xfj:document for each file. The xfj:external-content of the first document will reference the PDF file and the xfj:apply-local-template of the second document will reference the XFD style-sheet. In addition, the second document will have an xfj:external-content referencing the XML file.

 

Note that all paths are relative to the DAL job file.

 

This is the DAL job file:

 

<?xml version="1.0" encoding="utf-8"?>

<xfj:job xmlns:xfj="http://www.ecrion.com/xfj/1.0">

 

       <xfj:output mime-type="application/pdf"/>

 

       <xfj:document id="doc2" title="Current Superannuation">

               <xfj:external-content src="InputPDF.pdf"/>

       </xfj:document>

 

       <xfj:document id="doc3" title="Your Funds">

               <xfj:apply-local-template src="InputXFD.xfd"/>

               <xfj:external-content src="data.xml"/>

       </xfj:document>        

 

</xfj:job>

 

All the files referenced can be found in the XML Samples folder.