Debian Codegraph @

demo/legacypdf/xslfo/dita2fo-subroutines.xsl

raw symbols SCIP
1 <?xml version='1.0'?>
2 <!-- This file is part of the DITA Open Toolkit project hosted on
3 Sourceforge.net. See the accompanying license.txt file for
4 applicable licenses.-->
5 <!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved. -->
6
7 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8 xmlns:fo="http://www.w3.org/1999/XSL/Format"
9 version='1.0'>
10
11
12
13 <!-- Most of these routines are specific to Print output. For authoring, expose
14 these attributes to direct authoring whereever possible. -->
15
16
17 <!-- =================== start of processors ====================== -->
18
19
20 <!-- SET UP KEYS FOR XREF MANAGEMENT -->
21
22 <!-- set up keys based on xref's "type" attribute: %info-types;|hd|fig|table|li|fn -->
23 <!-- uses "title"
24 <xsl:key name="topic" match="topic" use="@id"/>
25 <xsl:key name="fig" match="fig" use="@id"/>
26 <xsl:key name="table" match="table" use="@id"/>
27 -->
28
29 <!-- uses "?"
30 <xsl:key name="li" match="li" use="@id"/>
31 -->
32
33 <!-- uses "callout?"
34 <xsl:key name="fn" match="fn" use="@id"/>
35 -->
36
37
38 <!-- COMMON ATTRIBUTE PROCESSORS -->
39
40 <!-- If the element has an ID, copy it through as an anchor. -->
41 <xsl:template match="@id">
42 <!-- Filler for A-name anchors (empty links)-->
43 <xsl:variable name="afill"></xsl:variable>
44 <fo:block>
45 <xsl:attribute name="id">
46 <!--We delete the line to get parent id here -->
47 <xsl:value-of select="."/><!-- generate id according to current node -->
48 </xsl:attribute>
49 <xsl:value-of select="$afill"/></fo:block>
50 </xsl:template>
51
52
53 <!-- Generate an ID to use for generated toc. -->
54 <xsl:template name="gen-toc-id">
55 <!-- Filler for A-name anchors (empty links)-->
56 <xsl:variable name="afill"></xsl:variable>
57 <xsl:variable name="id-value">
58 <xsl:choose>
59 <xsl:when test="@id">
60 <xsl:value-of select="@id"/>
61 </xsl:when>
62 <xsl:otherwise>
63 <xsl:value-of select="generate-id()"/>
64 </xsl:otherwise>
65 </xsl:choose>
66 </xsl:variable>
67 <fo:block id="{$id-value}"><xsl:value-of select="$afill"/></fo:block>
68 </xsl:template>
69
70
71 <!-- Create the class attribute for an element when the DITA element has an outputclass attribute. -->
72 <xsl:template name="setclass"/> <!-- turned off for now; not needed for authoring -->
73 <xsl:template name="xsetclass">
74 <xsl:if test="@outputclass">
75 <xsl:attribute name="class"><xsl:value-of select="@outputclass"/></xsl:attribute>
76 </xsl:if>
77 </xsl:template>
78
79
80 <!-- If the element has a compact=yes attribute, assert it in contextually correct form. -->
81 <!-- (assumes that no compaction is default) -->
82 <xsl:template match="@compact">
83 <xsl:if test=". = 'yes'">
84 <!--xsl:attribute name="compact">compact</xsl:attribute-->
85 <!-- NOOP for FO for now; must use padding attributes in block context -->
86 </xsl:if>
87 </xsl:template>
88
89 <!-- setscale and setframe work are based on text properties. For display-atts
90 used for other content, we'll need to develop content-specific attribute processors -->
91
92 <!-- Process the scale attribute for text contexts -->
93 <xsl:template name="setscale">
94 <xsl:if test="@scale">
95 <!-- For applications that do not yet take percentages. need to divide by 10 and use "pt" -->
96 <xsl:attribute name="font-size"><xsl:value-of select="@scale div 10"/>pt</xsl:attribute>
97 </xsl:if>
98 </xsl:template>
99
100 <!-- Process the frame attribute -->
101 <!-- frame styles (setframe) must be called within a block that defines the content being framed -->
102 <xsl:template name="setframe">
103 <!-- top | topbot -->
104 <xsl:if test="contains(@frame,'top')">
105 <xsl:attribute name="border-top-color">black</xsl:attribute>
106 <xsl:attribute name="border-top-width">thin</xsl:attribute>
107 </xsl:if>
108 <!-- bot | topbot -->
109 <xsl:if test="contains(@frame,'bot')">
110 <xsl:attribute name="border-bottom-color">black</xsl:attribute>
111 <xsl:attribute name="border-bottom-width">thin</xsl:attribute>
112 </xsl:if>
113 <!-- sides -->
114 <xsl:if test="contains(@frame,'sides')">
115 <xsl:attribute name="border-left-color">black</xsl:attribute>
116 <xsl:attribute name="border-left-width">thin</xsl:attribute>
117 <xsl:attribute name="border-right-color">black</xsl:attribute>
118 <xsl:attribute name="border-right-width">thin</xsl:attribute>
119 </xsl:if>
120 <xsl:if test="contains(@frame,'all')">
121 <xsl:attribute name="border-style">solid</xsl:attribute>
122 <xsl:attribute name="border-color">black</xsl:attribute>
123 <xsl:attribute name="border-width">thin</xsl:attribute>
124 </xsl:if>
125 </xsl:template>
126
127 <!-- =================== end of override stubs ====================== -->
128
129
130
131 </xsl:stylesheet>