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"
9 <!-- ********************************************************************
10 $Id: fo-rtf.xsl 6910 2007-06-28 23:23:30Z xmldoc $
11 ********************************************************************
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.
17 ******************************************************************** -->
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
24 <!-- ==================================================================== -->
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
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>
38 <xsl:template match=
"*" mode=
"insert.fo.fnum">
39 <xsl:param name=
"mark" select=
"'?'"/>
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>
48 <xsl:template match=
"fo:block" mode=
"insert.fo.fnum">
49 <xsl:param name=
"mark" select=
"'?'"/>
51 <xsl:for-each select=
"@*">
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')"/>
57 <xsl:copy-of select=
"."/>
61 <xsl:if test=
"not(preceding::fo:block)">
62 <xsl:copy-of select=
"$mark"/>
64 <xsl:apply-templates mode=
"insert.fo.fnum">
65 <xsl:with-param name=
"mark" select=
"$mark"/>
66 </xsl:apply-templates>
70 <xsl:template match=
"text()|processing-instruction()|comment()" mode=
"insert.fo.fnum">
71 <xsl:param name=
"mark" select=
"'?'"/>
75 <!-- ==================================================================== -->
77 <!-- insert.fo.block mode templates insert a particular RTF at the beginning
78 of the first paragraph in the primary RTF. -->
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>
87 <xsl:template match=
"*" mode=
"insert.fo.block">
88 <xsl:param name=
"mark" select=
"'?'"/>
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>
97 <xsl:template match=
"fo:block" mode=
"insert.fo.block">
98 <xsl:param name=
"mark" select=
"'?'"/>
100 <xsl:copy-of select=
"@*"/>
101 <xsl:if test=
"not(preceding::fo:block)">
102 <xsl:copy-of select=
"$mark"/>
104 <xsl:apply-templates mode=
"insert.fo.block">
105 <xsl:with-param name=
"mark" select=
"$mark"/>
106 </xsl:apply-templates>
110 <xsl:template match=
"text()|processing-instruction()|comment()" mode=
"insert.fo.block">
111 <xsl:param name=
"mark" select=
"'?'"/>
115 <!-- ==================================================================== -->
117 <!-- insert.fo.text mode templates insert a particular RTF at the beginning
118 of the first text-node in the primary RTF. -->
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>
127 <xsl:template match=
"*" mode=
"insert.fo.text">
128 <xsl:param name=
"mark" select=
"'?'"/>
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>
137 <xsl:template match=
"text()|processing-instruction()|comment()" mode=
"insert.fo.text">
138 <xsl:param name=
"mark" select=
"'?'"/>
140 <xsl:if test=
"not(preceding::text())">
141 <xsl:copy-of select=
"$mark"/>
147 <xsl:template match=
"processing-instruction()|comment()" mode=
"insert.fo.text">
148 <xsl:param name=
"mark" select=
"'?'"/>
152 <!-- ==================================================================== -->