XML Extensions - Envelop

This sample provides a simple illustration of the power of XSL-FO. The extend program creates an XML document containing the data used to address an envelope, and then uses CALL “C$SYSTEM” to invoke the Apache FOP processor.

Note: This sample program was created on Windows, and the Apache FOP processor binary distribution is assumed to be installed in C:\FOP. To use this example on Linux or UNIX, you must make two changes to the CALL C$SYSTEM statement:
  • A change to reflect the differences in CALL “C$SYSTEM” between Windows and Linux/UNIX.
  • A change to reflect the differences in installation of the Apache FOP binary distribution.

The sample data is exported from the COBOL program to envelope.xml. The Apache FOP process uses envelope.xml as its input document, transforming the input document using the XSL style sheet envelope.xsl, to produce the resulting PDF document, envelope.pdf. The XSL style sheet imports two other XSL style sheets, postnet.xsl and postnet-svg.xsl, which create the POSTNET bar code (using SVG graphics) for the addressee. The XSL style sheet also uses the JPEG file, MicroFocusLogo.jpg, to show how to include graphical elements in the output document.

Several commercial products are available to assist in creating an XSL style sheet that converts the data from XML to XSL-FO (envelope.xsl in the example). To find these products enter the search term XSL-FO WYSIWYG in a search engine. An XSL style sheet is a text document, so use a text editor to modify existing XSL style sheets, or to create style sheets for simple documents.