-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcards-2x3.xsl
110 lines (89 loc) · 3.93 KB
/
cards-2x3.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
<?xml version="1.0"?>
<!-- THIS FILE IS OUT OF DATE use 2x2 or modify before use-->
<!-- vim: set ts=2:sw=2: -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
>
<xsl:template match="/cardset">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="all-pages" page-width="8.5in" page-height="11in">
<fo:region-body margin=".25in .25in" column-gap="0in"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="my-sequence">
<fo:repeatable-page-master-reference master-reference="all-pages"/>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my-sequence">
<fo:flow flow-name="xsl-region-body" font-weight="bold" font-size=".2in">
<fo:table>
<fo:table-body>
<xsl:for-each select="whitecard|blackcard">
<xsl:if test="position() mod 4 = 1">
<fo:table-row>
<xsl:apply-templates select="."/>
<xsl:if test="count(./following-sibling::*[position()=1]) != 0">
<xsl:apply-templates select="./following-sibling::*[position()=1]"/>
</xsl:if>
<xsl:if test="count(./following-sibling::*[position()=2]) != 0">
<xsl:apply-templates select="./following-sibling::*[position()=2]"/>
</xsl:if>
<xsl:if test="count(./following-sibling::*[position()=3]) != 0">
<xsl:apply-templates select="./following-sibling::*[position()=3]"/>
</xsl:if>
</fo:table-row>
</xsl:if>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="whitecard">
<fo:table-cell border="solid black" padding=".1in" width="2in" height="2.8in">
<fo:block><xsl:apply-templates/></fo:block>
<fo:block-container absolute-position="absolute" top="2.6in">
<fo:block><fo:external-graphic src="url('footer.svg')"/></fo:block>
</fo:block-container>
</fo:table-cell>
</xsl:template>
<xsl:template match="blackcard[@pick=1]">
<fo:table-cell border="solid white" padding=".1in" width="2in" height="2.8in" background-color="#231f20" color="white">
<fo:block><xsl:value-of select="text()"/></fo:block>
<fo:block-container absolute-position="absolute" top="2.6in">
<fo:block><fo:external-graphic src="url('blackfooter.svg')"/></fo:block>
</fo:block-container>
</fo:table-cell>
</xsl:template>
<xsl:template match="blackcard[@pick=2]">
<fo:table-cell border="solid white" padding=".1in" width="2in" height="2.8in" background-color="#231f20" color="white">
<fo:block><xsl:value-of select="text()"/></fo:block>
<fo:block-container absolute-position="absolute" top="2.6in">
<fo:block><fo:external-graphic content-width="1.8in" src="url('blackfooterpick2.svg')"/></fo:block>
</fo:block-container>
</fo:table-cell>
</xsl:template>
<xsl:template match="blackcard[@pick=3]">
<fo:table-cell border="solid white" padding=".1in" width="2in" height="2.8in" background-color="#231f20" color="white">
<fo:block><xsl:value-of select="text()"/></fo:block>
<fo:block-container absolute-position="absolute" top="2.35in">
<fo:block><fo:external-graphic content-width="1.8in" src="url('blackfooterpick3.svg')"/></fo:block>
</fo:block-container>
</fo:table-cell>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="img">
<fo:external-graphic content-width="1.8in" content-height="1.6in">
<xsl:attribute name="src">
<xsl:text>url('</xsl:text>
<xsl:value-of select="@src"/> <!--FIXME escape out single quotes -->
<xsl:text>')</xsl:text>
</xsl:attribute>
</fo:external-graphic>
</xsl:template>
</xsl:stylesheet>