1 <xsl:stylesheet version="1.0"
2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format">
5 <xsl:output indent="yes"/>
6 <xsl:strip-space elements="*"/>
8 <xsl:param name="paper.type">A4</xsl:param>
9 <xsl:param name="page.orientation">portrait</xsl:param>
11 <xsl:param name="page.margin.bottom">0.5in</xsl:param>
12 <xsl:param name="page.margin.top">0.5in</xsl:param>
13 <xsl:param name="page.margin.inner">1in</xsl:param>
14 <xsl:param name="page.margin.outer">1in</xsl:param>
16 <xsl:param name="body.margin.bottom">10mm</xsl:param>
17 <xsl:param name="body.margin.top">10mm</xsl:param>
18 <xsl:param name="body.margin.inner">10mm</xsl:param>
19 <xsl:param name="body.margin.outer">10mm</xsl:param>
21 <xsl:param name="page.height.portrait">
23 <xsl:when test="$paper.type = 'A4landscape'">210mm</xsl:when>
24 <xsl:when test="$paper.type = 'USletter'">11in</xsl:when>
25 <xsl:when test="$paper.type = 'USlandscape'">8.5in</xsl:when>
26 <xsl:when test="$paper.type = 'A3'">420mm</xsl:when>
27 <xsl:when test="$paper.type = 'A4'">297mm</xsl:when>
28 <xsl:when test="$paper.type = 'A5'">210mm</xsl:when>
29 <xsl:otherwise>11in</xsl:otherwise>
32 <xsl:param name="page.width.portrait">
34 <xsl:when test="$paper.type = 'A4landscape'">297mm</xsl:when>
35 <xsl:when test="$paper.type = 'USletter'">8.5in</xsl:when>
36 <xsl:when test="$paper.type = 'USlandscape'">11in</xsl:when>
37 <xsl:when test="$paper.type = 'A3'">297mm</xsl:when>
38 <xsl:when test="$paper.type = 'A4'">210mm</xsl:when>
39 <xsl:when test="$paper.type = 'A5'">148mm</xsl:when>
40 <xsl:otherwise>8.5in</xsl:otherwise>
44 <xsl:param name="page.height">
46 <xsl:when test="$page.orientation = 'portrait'">
47 <xsl:value-of select="$page.height.portrait"/>
50 <xsl:value-of select="$page.width.portrait"/>
54 <xsl:param name="page.width">
56 <xsl:when test="$page.orientation = 'portrait'">
57 <xsl:value-of select="$page.width.portrait"/>
60 <xsl:value-of select="$page.height.portrait"/>
65 <xsl:template match="/">
67 <fo:layout-master-set>
68 <fo:simple-page-master master-name="first-page"
69 page-width="{$page.width}"
70 page-height="{$page.height}"
71 margin-top="{$page.margin.top}"
72 margin-bottom="{$page.margin.bottom}"
73 margin-left="{$page.margin.inner}"
74 margin-right="{$page.margin.outer}">
75 <fo:region-body margin-bottom="{$body.margin.bottom}"
76 margin-top="{$body.margin.top}"/>
77 </fo:simple-page-master>
78 </fo:layout-master-set>
80 <fo:page-sequence master-reference="first-page">
81 <fo:flow flow-name="xsl-region-body">
83 font-family="sans-serif"
88 <xsl:apply-templates/>
94 <xsl:template match="text()" />
96 <xsl:template match="accounts">
99 font-family="sans-serif"
103 <xsl:apply-templates/>
107 <xsl:template match="accounts/account">
108 <fo:block border-width="0.5mm" border-style="solid" border-color="green">
109 <xsl:apply-templates/>
113 <xsl:template match="accounts/*/account">
115 <xsl:when test="./fullname = ./name">
116 <fo:block keep-together="always" border-width="0.5mm"
117 border-style="solid" border-color="red">
118 <xsl:apply-templates/>
122 <fo:block border-width="0.2mm"
123 border-style="solid" border-color="black">
124 <xsl:apply-templates/>
130 <xsl:template match="account/account-total">
132 <xsl:value-of select="../fullname"/>
134 <fo:table table-layout="fixed" width="100%">
136 <xsl:apply-templates/>
141 <xsl:template match="account/account-total/balance/amount|account/account-total/amount">
144 <fo:block font-family="monospace" text-align="right">
145 <xsl:value-of select="./commodity/symbol"/>
149 <fo:block font-family="monospace" text-align="right">
150 <xsl:value-of select="format-number(./quantity, '###0.00')"/>
156 <xsl:template match="transactions">
159 page-break-before="always"
160 font-family="sans-serif"
164 <xsl:apply-templates/>
168 <xsl:template match="transaction">
169 <fo:block-container keep-together="always" border-width="0.2mm"
170 border-style="solid">
171 <xsl:apply-templates/>
172 </fo:block-container>
175 <xsl:template match="transaction/date">
178 <xsl:value-of select="concat(substring(., 1, 4),'-',substring(., 6, 2),'-',substring(., 9, 2))"/>
180 </fo:block-container>
183 <xsl:template match="transaction/payee">
184 <fo:block-container background-color="silver">
186 <xsl:value-of select="."/>
188 </fo:block-container>
191 <xsl:template match="postings">
192 <fo:block-container space-after="3mm">
193 <fo:table table-layout="fixed" width="100%">
195 <xsl:apply-templates/>
198 </fo:block-container>
201 <xsl:template match="postings/posting">
203 <xsl:apply-templates/>
207 <xsl:template match="postings/posting/account/name">
209 <fo:block font-family="monospace">
210 <xsl:value-of select="."/>
215 <xsl:template match="postings/posting/post-amount/amount/quantity">
217 <fo:block font-family="monospace" text-align="right">
218 <xsl:value-of select="format-number(., '####.00')"/>
223 <xsl:template match="postings/posting/post-amount/amount/commodity/symbol">
225 <fo:block font-family="monospace" text-align="right">
226 <xsl:value-of select="."/>