invoice.xslt example
<!--
FOR DEMO USE ONLY
Copyright by Artem Saveliev artem@savelev.com
-->
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="objects" mode="invoice">
<fo:layout-master-set>
<fo:simple-page-master page-height="11in" page-width="8.5in" margin="0.125in" master-name="page_master">
<fo:region-body border-style="dashed" border-width="thick" margin="0in" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence initial-page-number="1" master-reference="page_master">
<fo:flow flow-name="xsl-region-body">
<fo:block-container position="absolute" top="0.02in" left="0in" height="1.28in" width="8.25in">
<xsl:if test="$useForm != 'yes'">
<fo:external-graphic src="url(c:\inetpub\wwwroot\tires\printing\images\header-invoice.png)" height="1.28in" width="8.25in" />
</xsl:if>
</fo:block-container>
<xsl:if test="$useForm != 'yes'">
<fo:block-container position="absolute" top="1.47in" left="0.34in" height="0.2in" width="2.57in">
<fo:block xsl:use-attribute-sets="prePrintedText" font-size="12pt">SOLD TO:</fo:block>
</fo:block-container>
</xsl:if>
<fo:block-container position="absolute" top="1.50in" left="1.29in" height="1in" width="2.57in">
<fo:block xsl:use-attribute-sets="text">
<xsl:value-of select="accounts/s/b/custvehicle/guser/store/orderz/@selectedName" />  Account # <xsl:value-of select="accounts/@accountNo" />
<fo:block />
<xsl:value-of select="accounts/s/b/@billingAddress1" />
<fo:block />
<xsl:value-of select="accounts/s/b/@billingAddress2" />
<fo:block />
<xsl:value-of select="accounts/s/b/@billingCity" />, <xsl:value-of select="accounts/s/b/@billingState" /> <xsl:value-of select="accounts/s/b/@billingZip" />
</fo:block>
</fo:block-container>
<xsl:if test="$useForm != 'yes'">
<fo:block-container position="absolute" top="1.47in" left="4.5in" height="0.2in" width="2.57in">
<fo:block xsl:use-attribute-sets="prePrintedText" font-size="12pt">SHIP TO:</fo:block>
</fo:block-container>
</xsl:if>
<fo:block-container position="absolute" top="1.50in" left="5.25in" height="1in" width="2.57in">
<fo:block xsl:use-attribute-sets="text">
<xsl:value-of select="accounts/s/b/custvehicle/guser/store/orderz/@selectedName" />
<fo:block />
<xsl:value-of select="accounts/s/@shippingAddress1" />
<fo:block />
<xsl:value-of select="accounts/s/@shippingAddress2" />
<fo:block />
<xsl:value-of select="accounts/s/@shippingCity" />, <xsl:value-of select="accounts/s/@shippingState" /> <xsl:value-of select="accounts/s/@shippingZip" />
</fo:block>
</fo:block-container>
<!-- ROW 1 -->
<fo:block-container position="absolute" top="2.37in" left="0in" height="0.6in" width="8.25in">
<fo:table height="0.44in" xsl:use-attribute-sets="head-table">
<fo:table-column column-width="0.99in"/>
<fo:table-column column-width="1.25in"/>
<fo:table-column column-width="1.36in" />
<fo:table-column column-width="1.62in" />
<fo:table-column column-width="0.82in" />
<fo:table-column column-width="0.92in" />
<fo:table-column column-width="1.29in" />
<fo:table-header>
<fo:table-row xsl:use-attribute-sets="title-row" height="0.3in">
<fo:table-cell xsl:use-attribute-sets="title-cell" border-left-style="none">
<fo:block xsl:use-attribute-sets="title-text">
INVOICE #
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
PREVIOUS SHIPPED
INVOICE NUMBER
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
CUSTOMER PO#
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
MAKE-MODEL
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
TAG
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
MILEAGE
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
TELEPHONE
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row xsl:use-attribute-sets="head-row" height="0.3in">
<fo:table-cell xsl:use-attribute-sets="head-cell" border-left-style="none">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/@quoteno" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head-cell">
<fo:block xsl:use-attribute-sets="head-text"></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head-cell">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/@customerpono" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head-cell">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/@makemodel" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head-cell">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/@tag" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head-cell">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/@milage" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head-cell">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/guser/@phone" /></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block-container>
<!-- ROW 2 -->
<fo:block-container position="absolute" top="3.0in" left="0in" height="0.4in" width="8.25in">
<fo:table height="0.44in" xsl:use-attribute-sets="head-table">
<fo:table-column column-width="0.99in"/>
<fo:table-column column-width="2.56in"/>
<fo:table-column column-width="0.82in" />
<fo:table-column column-width="1in" />
<fo:table-column column-width="1in" />
<fo:table-column column-width="1.88in" />
<fo:table-header>
<fo:table-row xsl:use-attribute-sets="title-row" height="0.2in">
<fo:table-cell xsl:use-attribute-sets="title-cell" border-left-style="none">
<fo:block xsl:use-attribute-sets="title-text">
INVOICE DATE
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
SHIP VIA
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
ROUTE
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
DOCUMENT #
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
TERMS
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
SALES REP
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row xsl:use-attribute-sets="head-row" height="0.3in">
<fo:table-cell xsl:use-attribute-sets="head-cell" border-left-style="none">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/guser/@quotedate" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head-cell">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/guser/@shipVia" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head-cell">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/guser/store/orderz/@orderRoute" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head-cell">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/guser/store/orderz/@InvoiceNumber" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head-cell">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/custvehicle/guser/@Terms" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head-cell">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/custvehicle/guser/@salesrep" /></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block-container>
<!-- DATA TABLE -->
<fo:block-container position="absolute" top="3.51in" left="0in" height="4.36in" width="8.25in">
<fo:table height="5.14in" xsl:use-attribute-sets="box">
<fo:table-column column-width="0.99in"/>
<fo:table-column column-width="0.98in"/>
<fo:table-column column-width="2.58in" />
<fo:table-column column-width="0.64in" />
<fo:table-column column-width="0.64in" />
<fo:table-column column-width="0.64in" />
<fo:table-column column-width="0.48in" />
<fo:table-column column-width="0.44in" />
<fo:table-column column-width="0.85in" />
<fo:table-header>
<fo:table-row xsl:use-attribute-sets="title-row">
<fo:table-cell xsl:use-attribute-sets="title-cell" border-left-style="none">
<fo:block xsl:use-attribute-sets="title-text">
ITEM #
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
SIZE
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
DESCRIPTION
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
QUANTITY
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
UNIT PRICE
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
SALES TAX
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
TIRE TAX
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
F.E.T.
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="title-cell">
<fo:block xsl:use-attribute-sets="title-text">
EXTENSION
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:for-each select="accounts/s/b/custvehicle/guser/store/orderz/orderzs">
<fo:table-row xsl:use-attribute-sets="line-row">
<fo:table-cell xsl:use-attribute-sets="line-cell" border-left-style="none">
<fo:block xsl:use-attribute-sets="line-text"><xsl:value-of select="@itemno" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text"><xsl:value-of select="@size" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text"><xsl:value-of select="@description" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text"><xsl:value-of select="@quantity" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text"><xsl:value-of select="@unitprice" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text"><xsl:value-of select="@salestax" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text"><xsl:value-of select="@tiretax" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text"><xsl:value-of select="format-number(@quantity * @fet, '#,##0.00')" /></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text"><xsl:value-of select="@extprice" /></fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:if test="@discount > 0">
<fo:table-row xsl:use-attribute-sets="line-row">
<fo:table-cell xsl:use-attribute-sets="line-cell" border-left-style="none">
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text">
Discount
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text">
<xsl:value-of select="itemmaster/itempricelist/jpackage/orderm[@moretype='discount']/@reason" />
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text">
<xsl:value-of select="@qty" />
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text">
(<xsl:value-of select="format-number(@discount div @quantity, '#,##0.00')" />)
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="line-cell">
<fo:block xsl:use-attribute-sets="line-text">
(<xsl:value-of select="format-number(@discount, '#,##0.00')" />)
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block-container>
<!-- Comments -->
<fo:block-container xsl:use-attribute-sets="box" position="absolute" top="7.93in" left="0in" height="1.65in" width="3.73in">
<fo:block-container xsl:use-attribute-sets="title-cell" height="0.16in" width="1.04in" border-left-style="none">
<fo:block xsl:use-attribute-sets="title-text">COMMENTS:</fo:block>
</fo:block-container>
<fo:block xsl:use-attribute-sets="text" margin="0.15in" padding="0.1in"><xsl:value-of select="accounts/s/b/custvehicle/guser/store/orderz/@comments" /></fo:block>
</fo:block-container>
<fo:block-container xsl:use-attribute-sets="box" position="absolute" top="7.93in" left="3.83in" height="1.65in" width="1.93in">
<fo:block xsl:use-attribute-sets="text" margin="0.1in" padding="0.1in"><xsl:value-of select="accounts/s/b/custvehicle/guser/store/@storeNote" /></fo:block>
</fo:block-container>
<!-- Totals -->
<fo:block-container position="absolute" top="7.93in" left="5.86in" height="2.2in" width="2.39in">
<fo:table height="2.2in" width="2.39in" xsl:use-attribute-sets="box">
<fo:table-column column-width="1.35in" />
<fo:table-column column-width="1.04in" />
<fo:table-body>
<fo:table-row height="0.23in">
<fo:table-cell xsl:use-attribute-sets="title">
<fo:block xsl:use-attribute-sets="title-text">PRODUCTS</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head">
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/guser/store/orderz/@totalProducts" /></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row height="0.23in">
<fo:table-cell xsl:use-attribute-sets="title">
<xsl:if test="$useForm != 'yes'">
<xsl:attribute name="border-top-style">solid</xsl:attribute>
</xsl:if>
<fo:block xsl:use-attribute-sets="title-text">LABOR</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head">
<xsl:if test="$useForm != 'yes'">
<xsl:attribute name="border-top-style">solid</xsl:attribute>
</xsl:if>
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/guser/store/orderz/@totalLabor" /></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row height="0.23in">
<fo:table-cell xsl:use-attribute-sets="title">
<xsl:if test="$useForm != 'yes'">
<xsl:attribute name="border-top-style">solid</xsl:attribute>
</xsl:if>
<fo:block xsl:use-attribute-sets="title-text">OTHER</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head">
<xsl:if test="$useForm != 'yes'">
<xsl:attribute name="border-top-style">solid</xsl:attribute>
</xsl:if>
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/guser/store/orderz/@totalOther" /></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row height="0.23in">
<fo:table-cell xsl:use-attribute-sets="title">
<xsl:if test="$useForm != 'yes'">
<xsl:attribute name="border-top-style">solid</xsl:attribute>
</xsl:if>
<fo:block xsl:use-attribute-sets="title-text">STATE SALES TAX</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head">
<xsl:if test="$useForm != 'yes'">
<xsl:attribute name="border-top-style">solid</xsl:attribute>
</xsl:if>
<fo:block xsl:use-attribute-sets="head-text"><xsl:value-of select="accounts/s/b/custvehicle/guser/store/orderz/@totalStateTax" /></fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row height="0.23in">
<fo:table-cell xsl:use-attribute-sets="title">
<xsl:if test="$useForm != 'yes'">
<xsl:attribute name="border-top-style">solid</xsl:attribute>
</xsl:if>
<fo:block xsl:use-attribute-sets="title-text">LOCAL SALES TAX</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="head">
<xsl:if test="$useForm != 'yes'">
<xsl:a