source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/fo/fo-rtf.xsl@ cbe40efb

clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since cbe40efb was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 5.1 KB
Line 
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format"
4 xmlns:exsl="http://exslt.org/common"
5 xmlns:set="http://exslt.org/sets"
6 exclude-result-prefixes="exsl set"
7 version="1.0">
8
9<!-- ********************************************************************
10 $Id$
11 ********************************************************************
12
13 This file is part of the DocBook XSL Stylesheet distribution.
14 See ../README or http://docbook.sf.net/ for copyright
15 copyright and other information.
16
17 ******************************************************************** -->
18
19<!-- This module contains templates that match against FO nodes. It is used
20 to post-process result tree fragments for some sorts of cleanup.
21 These templates can only ever be fired by a processor that supports
22 exslt:node-set(). -->
23
24<!-- ==================================================================== -->
25
26<!-- insert.fo.fnum mode templates insert a particular RTF at the beginning
27 of the first paragraph in the primary RTF. In fact, they are inserting
28 a footnote-number, so we tinker a few other things too, like spacing and
29 font-sizes. -->
30
31<xsl:template match="/" mode="insert.fo.fnum">
32 <xsl:param name="mark" select="'?'"/>
33 <xsl:apply-templates mode="insert.fo.fnum">
34 <xsl:with-param name="mark" select="$mark"/>
35 </xsl:apply-templates>
36</xsl:template>
37
38<xsl:template match="*" mode="insert.fo.fnum">
39 <xsl:param name="mark" select="'?'"/>
40 <xsl:copy>
41 <xsl:copy-of select="@*"/>
42 <xsl:apply-templates mode="insert.fo.fnum">
43 <xsl:with-param name="mark" select="$mark"/>
44 </xsl:apply-templates>
45 </xsl:copy>
46</xsl:template>
47
48<xsl:template match="fo:block" mode="insert.fo.fnum">
49 <xsl:param name="mark" select="'?'"/>
50 <xsl:copy>
51 <xsl:for-each select="@*">
52 <xsl:choose>
53 <xsl:when test="starts-with(name(.), 'space-before')"/>
54 <xsl:when test="starts-with(name(.), 'space-after')"/>
55 <xsl:when test="starts-with(name(.), 'font-size')"/>
56 <xsl:otherwise>
57 <xsl:copy-of select="."/>
58 </xsl:otherwise>
59 </xsl:choose>
60 </xsl:for-each>
61 <xsl:if test="not(preceding::fo:block)">
62 <xsl:copy-of select="$mark"/>
63 </xsl:if>
64 <xsl:apply-templates mode="insert.fo.fnum">
65 <xsl:with-param name="mark" select="$mark"/>
66 </xsl:apply-templates>
67 </xsl:copy>
68</xsl:template>
69
70<xsl:template match="text()|processing-instruction()|comment()" mode="insert.fo.fnum">
71 <xsl:param name="mark" select="'?'"/>
72 <xsl:copy/>
73</xsl:template>
74
75<!-- ==================================================================== -->
76
77<!-- insert.fo.block mode templates insert a particular RTF at the beginning
78 of the first paragraph in the primary RTF. -->
79
80<xsl:template match="/" mode="insert.fo.block">
81 <xsl:param name="mark" select="'?'"/>
82 <xsl:apply-templates mode="insert.fo.block">
83 <xsl:with-param name="mark" select="$mark"/>
84 </xsl:apply-templates>
85</xsl:template>
86
87<xsl:template match="*" mode="insert.fo.block">
88 <xsl:param name="mark" select="'?'"/>
89 <xsl:copy>
90 <xsl:copy-of select="@*"/>
91 <xsl:apply-templates mode="insert.fo.block">
92 <xsl:with-param name="mark" select="$mark"/>
93 </xsl:apply-templates>
94 </xsl:copy>
95</xsl:template>
96
97<xsl:template match="fo:block" mode="insert.fo.block">
98 <xsl:param name="mark" select="'?'"/>
99 <xsl:copy>
100 <xsl:copy-of select="@*"/>
101 <xsl:if test="not(preceding::fo:block)">
102 <xsl:copy-of select="$mark"/>
103 </xsl:if>
104 <xsl:apply-templates mode="insert.fo.block">
105 <xsl:with-param name="mark" select="$mark"/>
106 </xsl:apply-templates>
107 </xsl:copy>
108</xsl:template>
109
110<xsl:template match="text()|processing-instruction()|comment()" mode="insert.fo.block">
111 <xsl:param name="mark" select="'?'"/>
112 <xsl:copy/>
113</xsl:template>
114
115<!-- ==================================================================== -->
116
117<!-- insert.fo.text mode templates insert a particular RTF at the beginning
118 of the first text-node in the primary RTF. -->
119
120<xsl:template match="/" mode="insert.fo.text">
121 <xsl:param name="mark" select="'?'"/>
122 <xsl:apply-templates mode="insert.fo.text">
123 <xsl:with-param name="mark" select="$mark"/>
124 </xsl:apply-templates>
125</xsl:template>
126
127<xsl:template match="*" mode="insert.fo.text">
128 <xsl:param name="mark" select="'?'"/>
129 <xsl:copy>
130 <xsl:copy-of select="@*"/>
131 <xsl:apply-templates mode="insert.fo.text">
132 <xsl:with-param name="mark" select="$mark"/>
133 </xsl:apply-templates>
134 </xsl:copy>
135</xsl:template>
136
137<xsl:template match="text()|processing-instruction()|comment()" mode="insert.fo.text">
138 <xsl:param name="mark" select="'?'"/>
139
140 <xsl:if test="not(preceding::text())">
141 <xsl:copy-of select="$mark"/>
142 </xsl:if>
143
144 <xsl:copy/>
145</xsl:template>
146
147<xsl:template match="processing-instruction()|comment()" mode="insert.fo.text">
148 <xsl:param name="mark" select="'?'"/>
149 <xsl:copy/>
150</xsl:template>
151
152<!-- ==================================================================== -->
153
154</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.