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 is omitted, then the default output will be PDF.

 

Code sample:

 

 

<?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 is only natural that this first example presents 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 should be the following:

 

 

An xfj:document will be used 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:

·All paths are relative to the DAL job file.

 

The DAL job file for this example will be the following:

 

 

<?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.