root/trunk/spec/single_fo.xsl

Revision 7, 4.8 KB (checked in by oren, 8 months ago)

April 06, 2008 draft.

Implemented by YamlReference? 0.9.

Contains new productions, new examples, all the changes collected throughout
the last 3 years, and of course JSON compatibility.

Line 
1<?xml version="1.0"?> 
2
3<!--
4 - Customize the generation of FO from the DocBook sources for the YAML spec.
5-->
6
7<xsl:stylesheet
8    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9    xmlns:fo="http://www.w3.org/1999/XSL/Format"
10    version="1.0"> 
11
12  <!-- Invoke the DocBook -> FO conversion stylesheet -->
13  <xsl:import href="docbook_xslt/fo/docbook.xsl" />
14
15  <!-- Override the EBNF formatting -->
16  <xsl:import href="ebnf_fo.xsl" />
17
18  <!-- Using XEP extensions, lucky us! -->
19  <xsl:param name="xep.extensions" select="1" />
20
21  <!-- Force index to be in two columns -->
22  <xsl:param name="column.count.index" select="2" />
23
24  <!-- Output control. No need to worry about document type. -->
25  <xsl:output method="xml" encoding="ISO-8859-1" indent="yes" />
26
27  <!-- Pass fo only -->
28  <xsl:template match="fo"
29    ><xsl:apply-templates select='*|text()'
30  /></xsl:template>
31
32  <!-- Border for examples -->
33  <xsl:template match="database"
34    ><fo:block
35        border-style="solid" border-color="black" border-width="thin"
36        ><xsl:apply-templates mode="highlight" select='*|text()'
37    /></fo:block
38  ></xsl:template>
39
40  <!-- Convert HL -->
41  <xsl:template match="HL"
42    ><xsl:apply-templates mode="highlight" select='*|text()'
43  /></xsl:template>
44
45  <!-- Convert normal hl1 -->
46  <xsl:template match="hl1"
47    ><fo:inline
48      border-style="solid" border-color="black" border-width="thin"
49      ><xsl:apply-templates select='*|text()'
50    /></fo:inline
51  ></xsl:template>
52
53  <!-- Convert HL/hl1 -->
54  <xsl:template mode="highlight" match="hl1"
55    ><fo:inline
56      line-height="150%" padding="4px"
57      border-style="solid" border-color="black" border-width="thin"
58      ><xsl:apply-templates select='*|text()'
59    /></fo:inline
60  ></xsl:template>
61
62  <!-- Convert normal hl2 -->
63  <xsl:template match="hl2"
64    ><fo:inline
65      border-style="dotted" border-color="black" border-width="thin"
66      ><xsl:apply-templates select='*|text()'
67    /></fo:inline
68  ></xsl:template>
69
70  <!-- Convert HL/hl2 -->
71  <xsl:template mode="highlight" match="hl2"
72    ><fo:inline
73      line-height="150%" padding="4px"
74      border-style="dotted" border-color="black" border-width="thin"
75      ><xsl:apply-templates select='*|text()'
76    /></fo:inline
77  ></xsl:template>
78
79  <!-- Convert normal hl3 -->
80  <xsl:template match="hl3"
81    ><fo:inline
82      border-style="dashed" border-color="black" border-width="thin"
83      ><xsl:apply-templates select='*|text()'
84    /></fo:inline
85  ></xsl:template>
86
87  <!-- Convert HL/hl3 -->
88  <xsl:template mode="highlight" match="hl3"
89    ><fo:inline
90      line-height="150%" padding="4px"
91      border-style="dashed" border-color="black" border-width="thin"
92      ><xsl:apply-templates select='*|text()'
93    /></fo:inline
94  ></xsl:template>
95
96  <!-- Convert normal hl4 -->
97  <xsl:template match="hl4"
98    ><fo:inline
99      border-style="dotted" border-color="black" border-width="0.499pt"
100      ><xsl:apply-templates select='*|text()'
101    /></fo:inline
102  ></xsl:template>
103
104  <!-- Convert HL/hl4 -->
105  <xsl:template mode="highlight" match="hl4"
106    ><fo:inline
107      line-height="150%" padding="4px"
108      border-style="dotted" border-color="black" border-width="0.499pt"
109      ><xsl:apply-templates select='*|text()'
110    /></fo:inline
111  ></xsl:template>
112
113  <!-- Add a <pagebreak/> command -->
114  <xsl:template match="pagebreak"
115    ><fo:block break-before="page"
116  /></xsl:template>
117
118  <!-- Steal the margins for some pesky productions -->
119  <xsl:param name="page.margin.inner">0.4in</xsl:param>
120  <xsl:param name="page.margin.outer">0.4in</xsl:param>
121  <xsl:param name="page.margin.top">0.4in</xsl:param>
122  <xsl:param name="page.margin.bottom">0.4in</xsl:param>
123
124  <!-- The common page area for US Letter and A4 -->
125  <xsl:param name="page.width">8.3in</xsl:param>
126  <xsl:param name="page.height">11in</xsl:param>
127
128  <!-- Reduce the width of terms in definition lists (to half). -->
129  <xsl:param name="variablelist.max.termlength">12</xsl:param>
130
131  <!-- Auto-number sections. The default doesn't. -->
132  <xsl:param name="section.autolabel" select="1" />
133
134  <!-- Include chapter number in section number (1.2 instead of 2). -->
135  <xsl:param name="section.label.includes.component.label" select="1" />
136
137  <!-- Include sect4 elements in TOC (the default is just sect2). -->
138  <xsl:param name="toc.section.depth">4</xsl:param>
139
140  <!-- Use less indentation in TOC (since we nest deep). -->
141  <xsl:param name="toc.indent.width">12</xsl:param>
142
143  <!-- Supress everything except a single top-level table of contents. -->
144  <xsl:param name="generate.toc">
145    set       toc,title
146    book      toc,title,index
147    article   title
148    part      nop
149    chapter   nop
150    preface   nop
151    qandadiv  nop
152    qandaset  nop
153    reference nop
154    sect1     nop
155    sect2     nop
156    sect3     nop
157    sect4     nop
158    sect5     nop
159    section   nop
160    appendix  nop
161  </xsl:param>
162</xsl:stylesheet> 
Note: See TracBrowser for help on using the browser.