Presented here is a simple example to get your started. It shows the basic method of identifying and extracting data from an XML document containing a single struct.
<?xml version="1.0" standalone="yes"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"> <xsl:template match="DOCUMENT"> <xsl:apply-templates select="DATA"/> </xsl:template> <xsl:template match="DATA"> <xsl:apply-templates select="STRUCT[SNAME='DPTicketDtls']"/> </xsl:template> <xsl:template match="STRUCT"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master page-master-name="only" page-height="297mm" page-width="210mm" margin-top="30mm" margin-bottom="30mm" margin-left="30mm" margin-right="30mm"> <fo:region-body/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence> <fo:sequence-specification> <fo:sequence-specifier-single page-master-reference="only"/> </fo:sequence-specification> <fo:flow> <fo:block font-size="12pt" font-family="serif" line-height="20mm"> Ticket ID: <xsl:apply-templates select="FIELD[FNAME='ticketID']"/> </fo:block> <fo:block font-size="12pt" font-family="serif" line-height="20mm"> Subject: <xsl:apply-templates select="FIELD[FNAME='subject']"/> </fo:block> </fo:flow> </fo:page-sequence> </fo:root> </xsl:template> <xsl:template match="FIELD"> <xsl:value-of select="VALUE"/> </xsl:template> </xsl:stylesheet>
The output is formatted for A4 paper (210x297mm) with 30mm margins and should appear like this, if the earlier sample XML document is used:
Ticket ID: 12796 Subject: This is the subject.