-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspellsonly.xsl
178 lines (161 loc) · 8.04 KB
/
spellsonly.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:param name="cover" select="'true'"/>
<xsl:param name="single" select="''"/>
<xsl:param name="edit" select="''"/>
<xsl:param name="flow" select="''"/>
<xsl:param name="orientation" select="'portrait'"/>
<xsl:param name="paper" select="'letter'"/>
<xsl:param name="source" select="'true'"/>
<xsl:output method="xml" indent="yes" />
<xsl:include href="file:./pagesetup.xsl"/>
<xsl:variable name="in" select="/" />
<xsl:variable name="sortedspells">
<xsl:for-each select="$in/ars_magica/spells/spell">
<xsl:sort select="name"/>
<xsl:copy-of select="current()"/>
</xsl:for-each>
</xsl:variable>
<xsl:include href="file:./styles.xsl"/>
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="spell-list" page-height="{$height}" page-width="{$width}" margin="0cm">
<fo:region-body column-count="{$cols}" margin-bottom="0.5in" margin-top="0.5in" margin-left="2cm" margin-right="2cm"/>
<fo:region-before region-name="xsl-region-before" extent=".5in" />
<fo:region-after region-name="xsl-region-after" extent=".5in" margin-right="2cm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="inner-leaf" page-height="{$height}" page-width="{$width}">
<fo:region-body margin="2cm" margin-right="2cm" />
<fo:region-before region-name="xsl-region-before" extent="3in"/>
<fo:region-after region-name="xsl-region-after" extent=".25in" />
</fo:simple-page-master>
</fo:layout-master-set>
<xsl:if test="$cover = 'true'">
<fo:page-sequence master-reference="inner-leaf">
<xsl:if test="$edit = ''">
<fo:static-content flow-name="xsl-region-before">
<fo:block-container absolute-position="absolute" top="0cm" left="0cm" width="{$width}" height="{$height}">
<fo:block>
<fo:external-graphic src="images/leaflet{$wide}.jpg" content-height="scale-to-fit" height="{$height}" content-width="{$width}" scaling="non-uniform"/>
</fo:block>
<fo:block></fo:block>
</fo:block-container>
</fo:static-content>
</xsl:if>
<fo:static-content flow-name="xsl-region-after"><fo:block></fo:block></fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates select="$in/ars_magica/preface" mode="preface"/>
</fo:flow>
</fo:page-sequence>
</xsl:if>
<xsl:choose>
<xsl:when test="$flow = 'true'"><xsl:call-template name="spellflow"/></xsl:when>
<xsl:otherwise><xsl:call-template name="spellsection"/></xsl:otherwise>
</xsl:choose>
<xsl:call-template name="spellindex"></xsl:call-template>
</fo:root>
</xsl:template>
<xsl:template name="spellflow">
<fo:page-sequence master-reference="spell-list">
<fo:static-content flow-name="xsl-region-before">
<xsl:if test="$edit = ''">
<fo:block-container absolute-position="absolute" top="0cm" left="0cm" width="{$width}" height="{$height}">
<fo:block>
<fo:external-graphic src="images/index-paper{$wide}.jpg" content-height="scale-to-fit" height="{$height}" content-width="{$width}" scaling="non-uniform"/>
</fo:block>
</fo:block-container>
</xsl:if>
<fo:block></fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block color="{$handcolour}" text-align-last="justify" font-family="{$textfont}" font-size="8pt" font-weight="normal" margin-left="2cm" margin-right="2cm">
<fo:page-number/><fo:leader leader-pattern="space" /><fo:retrieve-marker retrieve-class-name="form"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:for-each select="/ars_magica/arts/form/name">
<xsl:variable name="form" select="."/>
<xsl:for-each select="/ars_magica/arts/technique/name">
<xsl:variable name="technique" select="."/>
<xsl:variable name="toc_key"><xsl:value-of select="$technique"/> <xsl:value-of select="$form"/></xsl:variable>
<xsl:if test="count($in/ars_magica/spells/spell[arts/technique=$technique and arts/form=$form]) > 0">
<fo:block id="{$toc_key}"></fo:block>
<xsl:call-template name="formtechnique">
<xsl:with-param name="form" select="$form"/>
<xsl:with-param name="technique" select="$technique"/>
</xsl:call-template>
<fo:block margin-bottom="9px" font-weight="normal"> </fo:block>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</xsl:template>
<xsl:template name="spellsection">
<xsl:for-each select="/ars_magica/arts/form/name">
<xsl:variable name="form" select="."/>
<xsl:if test="($single = '') or ($single = $form)">
<xsl:for-each select="/ars_magica/arts/technique/name">
<xsl:variable name="technique" select="."/>
<xsl:call-template name="spellblock">
<xsl:with-param name="form" select="$form"/>
<xsl:with-param name="technique" select="$technique"/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="spellblock">
<xsl:param name="form"/>
<xsl:param name="technique"/>
<fo:page-sequence master-reference="spell-list">
<fo:static-content flow-name="xsl-region-before">
<xsl:if test="$edit = ''">
<fo:block-container absolute-position="absolute" top="0cm" left="0cm" width="{$width}" height="{$height}"
background-image="images/{$form}-paper.jpg">
<fo:block />
</fo:block-container>
</xsl:if>
<fo:block></fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block color="{$handcolour}" text-align-last="justify" font-family="{$textfont}" font-size="8pt" font-weight="normal" margin-left="2cm" margin-right="2cm">
<fo:page-number/><fo:leader leader-pattern="space" /><xsl:value-of select="$technique"/><xsl:text> </xsl:text><xsl:value-of select="$form"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:variable name="toc_key"><xsl:value-of select="$technique"/> <xsl:value-of select="$form"/></xsl:variable>
<fo:block id="{$toc_key}"></fo:block>
<xsl:call-template name="formtechnique">
<xsl:with-param name="form" select="$form"/>
<xsl:with-param name="technique" select="$technique"/>
</xsl:call-template>
</fo:flow>
</fo:page-sequence>
</xsl:template>
<xsl:include href="file:./core.xsl"/>
<xsl:template match="toc" mode="preface">
<fo:block page-break-before="always"/>
<xsl:for-each select="$in/ars_magica/arts/form">
<xsl:variable name="form" select="name"/>
<fo:block font-family="{$textfont}" font-size="8pt" font-weight="normal" text-align-last="justify">
<xsl:value-of select="$form" />
</fo:block>
<xsl:for-each select="$in/ars_magica/arts/technique">
<xsl:variable name="technique" select="name"/>
<xsl:variable name="toc_key"><xsl:value-of select="$technique"/> <xsl:value-of select="$form"/></xsl:variable>
<fo:block margin-left="1em" font-family="{$textfont}" font-size="8pt" font-weight="normal" text-align-last="justify">
<fo:basic-link internal-destination="{$toc_key}">
<xsl:value-of select="$technique" />
<fo:leader leader-pattern="dots" />
<fo:page-number-citation ref-id="{$toc_key}" />
</fo:basic-link>
</fo:block>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>