| 1 |
<?xml version='1.0'?> |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
<!DOCTYPE xsl:transform [ |
| 8 |
<!ENTITY nbsp " "> |
| 9 |
]> |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 17 |
xmlns:fo="http://www.w3.org/1999/XSL/Format" |
| 18 |
version='1.1'> |
| 19 |
|
| 20 |
<xsl:param name="page.height"> |
| 21 |
<xsl:choose> |
| 22 |
<xsl:when test="$page.orientation = 'portrait'"> |
| 23 |
<xsl:value-of select="$page.height.portrait"/> |
| 24 |
</xsl:when> |
| 25 |
<xsl:otherwise> |
| 26 |
<xsl:value-of select="$page.width.portrait"/> |
| 27 |
</xsl:otherwise> |
| 28 |
</xsl:choose> |
| 29 |
</xsl:param> |
| 30 |
|
| 31 |
<xsl:param name="page.height.portrait"> |
| 32 |
<xsl:choose> |
| 33 |
<xsl:when test="$paper.type = 'A4landscape'">210mm</xsl:when> |
| 34 |
<xsl:when test="$paper.type = 'USletter'">11in</xsl:when> |
| 35 |
<xsl:when test="$paper.type = 'USlandscape'">8.5in</xsl:when> |
| 36 |
<xsl:when test="$paper.type = '4A0'">2378mm</xsl:when> |
| 37 |
<xsl:when test="$paper.type = '2A0'">1682mm</xsl:when> |
| 38 |
<xsl:when test="$paper.type = 'A0'">1189mm</xsl:when> |
| 39 |
<xsl:when test="$paper.type = 'A1'">841mm</xsl:when> |
| 40 |
<xsl:when test="$paper.type = 'A2'">594mm</xsl:when> |
| 41 |
<xsl:when test="$paper.type = 'A3'">420mm</xsl:when> |
| 42 |
<xsl:when test="$paper.type = 'A4'">297mm</xsl:when> |
| 43 |
<xsl:when test="$paper.type = 'A5'">210mm</xsl:when> |
| 44 |
<xsl:when test="$paper.type = 'A6'">148mm</xsl:when> |
| 45 |
<xsl:when test="$paper.type = 'A7'">105mm</xsl:when> |
| 46 |
<xsl:when test="$paper.type = 'A8'">74mm</xsl:when> |
| 47 |
<xsl:when test="$paper.type = 'A9'">52mm</xsl:when> |
| 48 |
<xsl:when test="$paper.type = 'A10'">37mm</xsl:when> |
| 49 |
<xsl:when test="$paper.type = 'B0'">1414mm</xsl:when> |
| 50 |
<xsl:when test="$paper.type = 'B1'">1000mm</xsl:when> |
| 51 |
<xsl:when test="$paper.type = 'B2'">707mm</xsl:when> |
| 52 |
<xsl:when test="$paper.type = 'B3'">500mm</xsl:when> |
| 53 |
<xsl:when test="$paper.type = 'B4'">353mm</xsl:when> |
| 54 |
<xsl:when test="$paper.type = 'B5'">250mm</xsl:when> |
| 55 |
<xsl:when test="$paper.type = 'B6'">176mm</xsl:when> |
| 56 |
<xsl:when test="$paper.type = 'B7'">125mm</xsl:when> |
| 57 |
<xsl:when test="$paper.type = 'B8'">88mm</xsl:when> |
| 58 |
<xsl:when test="$paper.type = 'B9'">62mm</xsl:when> |
| 59 |
<xsl:when test="$paper.type = 'B10'">44mm</xsl:when> |
| 60 |
<xsl:when test="$paper.type = 'C0'">1297mm</xsl:when> |
| 61 |
<xsl:when test="$paper.type = 'C1'">917mm</xsl:when> |
| 62 |
<xsl:when test="$paper.type = 'C2'">648mm</xsl:when> |
| 63 |
<xsl:when test="$paper.type = 'C3'">458mm</xsl:when> |
| 64 |
<xsl:when test="$paper.type = 'C4'">324mm</xsl:when> |
| 65 |
<xsl:when test="$paper.type = 'C5'">229mm</xsl:when> |
| 66 |
<xsl:when test="$paper.type = 'C6'">162mm</xsl:when> |
| 67 |
<xsl:when test="$paper.type = 'C7'">114mm</xsl:when> |
| 68 |
<xsl:when test="$paper.type = 'C8'">81mm</xsl:when> |
| 69 |
<xsl:when test="$paper.type = 'C9'">57mm</xsl:when> |
| 70 |
<xsl:when test="$paper.type = 'C10'">40mm</xsl:when> |
| 71 |
<xsl:otherwise>11in</xsl:otherwise> |
| 72 |
</xsl:choose> |
| 73 |
</xsl:param> |
| 74 |
|
| 75 |
<xsl:param name="page.width"> |
| 76 |
<xsl:choose> |
| 77 |
<xsl:when test="$page.orientation = 'portrait'"> |
| 78 |
<xsl:value-of select="$page.width.portrait"/> |
| 79 |
</xsl:when> |
| 80 |
<xsl:otherwise> |
| 81 |
<xsl:value-of select="$page.height.portrait"/> |
| 82 |
</xsl:otherwise> |
| 83 |
</xsl:choose> |
| 84 |
</xsl:param> |
| 85 |
<xsl:param name="page.width.portrait"> |
| 86 |
<xsl:choose> |
| 87 |
<xsl:when test="$paper.type = 'USletter'">8.5in</xsl:when> |
| 88 |
<xsl:when test="$paper.type = '4A0'">1682mm</xsl:when> |
| 89 |
<xsl:when test="$paper.type = '2A0'">1189mm</xsl:when> |
| 90 |
<xsl:when test="$paper.type = 'A0'">841mm</xsl:when> |
| 91 |
<xsl:when test="$paper.type = 'A1'">594mm</xsl:when> |
| 92 |
<xsl:when test="$paper.type = 'A2'">420mm</xsl:when> |
| 93 |
<xsl:when test="$paper.type = 'A3'">297mm</xsl:when> |
| 94 |
<xsl:when test="$paper.type = 'A4'">210mm</xsl:when> |
| 95 |
<xsl:when test="$paper.type = 'A5'">148mm</xsl:when> |
| 96 |
<xsl:when test="$paper.type = 'A6'">105mm</xsl:when> |
| 97 |
<xsl:when test="$paper.type = 'A7'">74mm</xsl:when> |
| 98 |
<xsl:when test="$paper.type = 'A8'">52mm</xsl:when> |
| 99 |
<xsl:when test="$paper.type = 'A9'">37mm</xsl:when> |
| 100 |
<xsl:when test="$paper.type = 'A10'">26mm</xsl:when> |
| 101 |
<xsl:when test="$paper.type = 'B0'">1000mm</xsl:when> |
| 102 |
<xsl:when test="$paper.type = 'B1'">707mm</xsl:when> |
| 103 |
<xsl:when test="$paper.type = 'B2'">500mm</xsl:when> |
| 104 |
<xsl:when test="$paper.type = 'B3'">353mm</xsl:when> |
| 105 |
<xsl:when test="$paper.type = 'B4'">250mm</xsl:when> |
| 106 |
<xsl:when test="$paper.type = 'B5'">176mm</xsl:when> |
| 107 |
<xsl:when test="$paper.type = 'B6'">125mm</xsl:when> |
| 108 |
<xsl:when test="$paper.type = 'B7'">88mm</xsl:when> |
| 109 |
<xsl:when test="$paper.type = 'B8'">62mm</xsl:when> |
| 110 |
<xsl:when test="$paper.type = 'B9'">44mm</xsl:when> |
| 111 |
<xsl:when test="$paper.type = 'B10'">31mm</xsl:when> |
| 112 |
<xsl:when test="$paper.type = 'C0'">917mm</xsl:when> |
| 113 |
<xsl:when test="$paper.type = 'C1'">648mm</xsl:when> |
| 114 |
<xsl:when test="$paper.type = 'C2'">458mm</xsl:when> |
| 115 |
<xsl:when test="$paper.type = 'C3'">324mm</xsl:when> |
| 116 |
<xsl:when test="$paper.type = 'C4'">229mm</xsl:when> |
| 117 |
<xsl:when test="$paper.type = 'C5'">162mm</xsl:when> |
| 118 |
<xsl:when test="$paper.type = 'C6'">114mm</xsl:when> |
| 119 |
<xsl:when test="$paper.type = 'C7'">81mm</xsl:when> |
| 120 |
<xsl:when test="$paper.type = 'C8'">57mm</xsl:when> |
| 121 |
<xsl:when test="$paper.type = 'C9'">40mm</xsl:when> |
| 122 |
<xsl:when test="$paper.type = 'C10'">28mm</xsl:when> |
| 123 |
<xsl:otherwise>8.5in</xsl:otherwise> |
| 124 |
</xsl:choose> |
| 125 |
</xsl:param> |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
<xsl:template name="setup-root"> |
| 132 |
<fo:root |
| 133 |
font-family="{$body.font.family}" |
| 134 |
font-size="{$body.font.size}"> |
| 135 |
<fo:layout-master-set> |
| 136 |
<fo:simple-page-master |
| 137 |
master-name="body" |
| 138 |
page-width="{$page.width}" |
| 139 |
page-height="{$page.height}" |
| 140 |
margin-top="{$page.margin.top}" |
| 141 |
margin-bottom="{$page.margin.bottom}" |
| 142 |
margin-left="{$page.margin.inner}" |
| 143 |
margin-right="{$page.margin.outer}"> |
| 144 |
|
| 145 |
<fo:region-body margin-bottom="{$body.margin.bottom}" |
| 146 |
margin-top="{$body.margin.top}" |
| 147 |
region-name="xsl-region-body"> |
| 148 |
</fo:region-body> |
| 149 |
</fo:simple-page-master> |
| 150 |
</fo:layout-master-set> |
| 151 |
|
| 152 |
<fo:page-sequence master-reference="body"> |
| 153 |
<fo:flow flow-name="xsl-region-body"> |
| 154 |
<xsl:apply-templates/> |
| 155 |
|
| 156 |
</fo:flow> |
| 157 |
</fo:page-sequence> |
| 158 |
</fo:root> |
| 159 |
</xsl:template> |
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
<xsl:template name="start-for-conref"> |
| 165 |
|
| 166 |
<xsl:choose> |
| 167 |
<xsl:when test="//@conref"> |
| 168 |
<xsl:variable name="copy-tree"> |
| 169 |
<xsl:apply-templates mode="resolve-conref"/> |
| 170 |
</xsl:variable> |
| 171 |
<xsl:apply-templates select="$copy-tree/*" mode="toplevel"/> |
| 172 |
</xsl:when> |
| 173 |
<xsl:otherwise> |
| 174 |
<xsl:apply-templates mode="toplevel"/> |
| 175 |
</xsl:otherwise> |
| 176 |
</xsl:choose> |
| 177 |
</xsl:template> |
| 178 |
|
| 179 |
</xsl:stylesheet> |