Debian Codegraph @

docbook-xsl-ns/fo/fo-rtf.xsl

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