Reformated README to Markdown
[wl2pdf.git] / xslt / wl2fo_pagemaster.xsl
1 <?xml version="1.0" encoding="utf-8"?>\r
2 <!-- \r
3     Copyright © 2009,2010 Łukasz Rekucki\r
4 \r
5     This file is part of WL2PDF\r
6 \r
7     WL2PDF is free software: you can redistribute it and/or modify\r
8     it under the terms of the GNU Affero General Public License as published by\r
9     the Free Software Foundation, either version 3 of the License, or\r
10     (at your option) any later version.\r
11 \r
12     WL2PDF is distributed in the hope that it will be useful,\r
13     but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
15     GNU Affero General Public License for more details.\r
16 \r
17     You should have received a copy of the GNU Affero General Public License\r
18     along with WL2PDF.  If not, see <http://www.gnu.org/licenses/>.\r
19  -->\r
20 <xsl:stylesheet\r
21     version="1.0"\r
22 \r
23     xmlns:wlml="http://nowoczesnapolska.org.pl/ML/Lektury/1.1"\r
24 \r
25     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
26     xmlns:fo="http://www.w3.org/1999/XSL/Format"\r
27     xmlns:wl="http://wolnelektury.pl/functions" >\r
28 \r
29     <xsl:template name="layout-masters">\r
30 \r
31         <fo:layout-master-set>\r
32     <!-- layout information -->\r
33             <fo:simple-page-master\r
34                     master-name="title-page"\r
35                   page-height="29.7cm"\r
36                   page-width="21cm"\r
37                   margin-top="2.5cm"\r
38                   margin-bottom="2.5cm"\r
39                   margin-left="2.5cm"\r
40                   margin-right="2.5cm">\r
41                 <fo:region-body />\r
42             </fo:simple-page-master>\r
43 \r
44             <fo:simple-page-master\r
45                     master-name="blank-page"\r
46                     page-height="29.7cm"\r
47                     page-width="21cm"\r
48 \r
49                     margin-top="2.5cm"\r
50                     margin-bottom="2.5cm"\r
51                     margin-left="2.5cm"\r
52                     margin-right="2.5cm">\r
53                 <fo:region-body />\r
54             </fo:simple-page-master>\r
55 \r
56             <fo:simple-page-master\r
57         master-name="first-main"\r
58                   page-height="29.7cm"\r
59                   page-width="21cm"\r
60                   margin-top="2cm"\r
61                   margin-bottom="2cm"\r
62                   margin-left="3cm"\r
63                   margin-right="2cm">\r
64                 <fo:region-body\r
65                 margin-top="2cm"\r
66                 margin-bottom="2cm" />\r
67                 <fo:region-after\r
68                 region-name="odd-after"\r
69                 display-align="after"\r
70                 extent="2cm" />\r
71             </fo:simple-page-master>\r
72 \r
73             <fo:simple-page-master\r
74         master-name="odd"\r
75                   page-height="29.7cm"\r
76                   page-width="21cm"\r
77                   margin-top="2cm"\r
78                   margin-bottom="2cm"\r
79                   margin-left="3cm"\r
80                   margin-right="2cm">\r
81                 <fo:region-body\r
82                 margin-top="2cm"\r
83                 margin-bottom="2cm" />\r
84 \r
85                 <fo:region-before\r
86                 region-name="odd-before"\r
87                 extent="2cm" />\r
88 \r
89                 <fo:region-after\r
90                 region-name="odd-after"\r
91                 display-align="after"\r
92                 extent="2cm" />\r
93             </fo:simple-page-master>\r
94 \r
95             <fo:simple-page-master\r
96         master-name="even"\r
97                   page-height="29.7cm"\r
98                   page-width="21cm"\r
99                   margin-top="2cm"\r
100                   margin-bottom="2cm"\r
101                   margin-left="2cm"\r
102                   margin-right="3cm">\r
103                 <fo:region-body\r
104                 margin-top="2cm"\r
105                 margin-bottom="2cm" />\r
106 \r
107                 <fo:region-before\r
108                 region-name="even-before"\r
109                 extent="2cm" />\r
110 \r
111                 <fo:region-after\r
112                 region-name="even-after"\r
113                 display-align="after"\r
114                 extent="2cm" />\r
115             </fo:simple-page-master>\r
116 \r
117 \r
118             <fo:page-sequence-master master-name="book-titles">\r
119                 <fo:single-page-master-reference master-reference="title-page" />\r
120                 <fo:repeatable-page-master-reference master-reference="blank-page" />\r
121             </fo:page-sequence-master>\r
122 \r
123             <fo:page-sequence-master master-name="main">\r
124                 <fo:repeatable-page-master-alternatives>\r
125                     <fo:conditional-page-master-reference\r
126                 master-reference="first-main"\r
127                 page-position="first"\r
128                 odd-or-even="odd" />\r
129 \r
130                     <fo:conditional-page-master-reference\r
131                 master-reference="odd"\r
132                 page-position="rest"\r
133                 odd-or-even="odd" />\r
134 \r
135                     <fo:conditional-page-master-reference\r
136                 master-reference="even"\r
137                 page-position="any"\r
138                 odd-or-even="even" />\r
139                 </fo:repeatable-page-master-alternatives>\r
140 \r
141             </fo:page-sequence-master>\r
142 \r
143         </fo:layout-master-set>\r
144     </xsl:template>\r
145     <!-- end: defines page layout -->\r
146 \r
147 \r
148     <xsl:template name="title-page">       \r
149 \r
150             <fo:flow flow-name="xsl-region-body"\r
151                 font-family="DejaVu Serif" text-align="center">\r
152 \r
153                 <fo:block font-size="32pt" display-align="center" >\r
154                     <fo:marker marker-class-name="author">\r
155                         <xsl:value-of select="//wlml:author" />\r
156                     </fo:marker>\r
157                     <xsl:apply-templates select="//wlml:author/node()" mode="title"/>\r
158                 </fo:block>\r
159 \r
160                 <fo:block font-size="48pt" display-align="center" >\r
161                     <fo:marker marker-class-name="main-title">\r
162                         <xsl:value-of select="//wlml:title" />\r
163                     </fo:marker>\r
164                     <xsl:apply-templates select="//wlml:title/node()" mode="title"/>\r
165                 </fo:block>\r
166             </fo:flow>\r
167         \r
168     </xsl:template>\r
169 \r
170 \r
171 </xsl:stylesheet>