summaryrefslogtreecommitdiff
path: root/doc/editor_configs/serna/scons/docbook-xsl-serna/refentry.xsl
blob: 178709c397f4d1c26428b3b40d34b491a8751c6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:fo="http://www.w3.org/1999/XSL/Format"
                xmlns:dtm="http://syntext.com/Extensions/DocumentTypeMetadata-1.0"
                extension-element-prefixes="dtm"
                version='1.0'>

<dtm:doc dtm:idref="reference"/>
<xsl:template match="reference" dtm:id="reference">
  <xsl:variable name="preamble"
                select="docinfo|title|subtitle|titleabbrev|partintro"/>
  <xsl:variable name="content"
                select="*[not(self::docinfo or self::title or self::subtitle
                        or self::titleabbrev or self::partintro)]"/>
  <fo:block 
    xsl:use-attribute-sets="component.block.properties">
    <xsl:call-template name="handle.empty">
      <xsl:with-param name="titles">
        <xsl:call-template name="reference.titlepage"/>
      </xsl:with-param>
      <xsl:with-param name="preamble" select="$preamble"/>
      <xsl:with-param name="content" select="$content"/>
    </xsl:call-template>
  </fo:block>
</xsl:template>

<dtm:doc dtm:idref="refentryinfo.refentry"/>
<xsl:template match="refentry/refentryinfo" dtm:id="refentryinfo.refentry"></xsl:template>

  <dtm:doc dtm:idref="partintro.reference"/>
  <xsl:template match="reference/partintro" dtm:id="partintro.reference">
    <fo:block>
      <xsl:if test="title">
        <xsl:call-template name="partintro.titlepage"/>
      </xsl:if>
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

<dtm:doc dtm:idref="refentry.refmeta"/>
<xsl:template match="refentry|refmeta" dtm:id="refentry.refmeta">
  <fo:block>
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

<dtm:doc dtm:idref="manvolnum"/>
<xsl:template match="manvolnum" dtm:id="manvolnum">
  <fo:inline>
    <xsl:text>(</xsl:text>
    <xsl:apply-templates/>
    <xsl:text>)</xsl:text>
  </fo:inline>
</xsl:template>

<dtm:doc dtm:idref="refmiscinfo"/>
<xsl:template match="refmiscinfo" dtm:id="refmiscinfo">
</xsl:template>

<dtm:doc dtm:idref="refentrytitle"/>
<xsl:template match="refentrytitle" dtm:id="refentrytitle">
  <xsl:call-template name="inline.charseq"/>
</xsl:template>

<dtm:doc dtm:idref="refnamediv"/>
<xsl:template match="refnamediv" dtm:id="refnamediv">
  <fo:block>
    <xsl:choose>
      <xsl:when test="$refentry.generate.name != 0">
        <fo:block xsl:use-attribute-sets="refentry.title.properties">
          <xsl:call-template name="gentext">
            <xsl:with-param name="key" select="'refname'"/>
          </xsl:call-template>
        </fo:block>
      </xsl:when>

      <xsl:when test="$refentry.generate.title != 0">
        <fo:block xsl:use-attribute-sets="refentry.title.properties">
          <xsl:choose>
            <xsl:when test="../refmeta/refentrytitle">
              <xsl:apply-templates 
                select="../refmeta/refentrytitle[not(self::processing-instruction('se:choice'))]"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:apply-templates 
                select="refname[not(self::processing-instruction('se:choice'))][1]"/>
            </xsl:otherwise>
          </xsl:choose>
        </fo:block>
      </xsl:when>
    </xsl:choose>
    <fo:block space-after="1em">
      <xsl:choose>
        <xsl:when test="../refmeta/refentrytitle">
          <xsl:apply-templates 
            select="../refmeta/refentrytitle"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates 
            select="refname[1]"/>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="refpurpose"/>
    </fo:block>
    <xsl:if test="string-length(refname) and count(refname) > 1">
      <fo:block>
        <xsl:for-each select="refname[not(self::processing-instruction('se:choice'))]">
          <xsl:apply-templates select="."/>
          <xsl:if test="following-sibling::refname[not(self::processing-instruction('se:choice'))][1]">
            <xsl:text>, </xsl:text>
          </xsl:if>
        </xsl:for-each>
      </fo:block>
    </xsl:if>
  </fo:block>
</xsl:template>

<dtm:doc dtm:idref="refname"/>
<xsl:template match="refname" dtm:id="refname">
  <fo:inline><xsl:apply-templates/></fo:inline>
</xsl:template>

<dtm:doc dtm:idref="refpurpose"/>
<xsl:template match="refpurpose" dtm:id="refpurpose">
  <fo:inline>
    <xsl:if test="node()">
      <xsl:text> </xsl:text>
      <xsl:call-template name="dingbat">
        <xsl:with-param name="dingbat">em-dash</xsl:with-param>
      </xsl:call-template>
      <xsl:text> </xsl:text>
    </xsl:if>
    <xsl:apply-templates/>
  </fo:inline>
</xsl:template>

<dtm:doc dtm:idref="refdescriptor"/>
<xsl:template match="refdescriptor" dtm:id="refdescriptor">
  <!-- todo: finish this -->
</xsl:template>

<dtm:doc dtm:idref="refclass"/>
<xsl:template match="refclass" dtm:id="refclass">
  <fo:block font-weight="bold">
    <xsl:if test="@role">
      <xsl:value-of select="@role"/>
      <xsl:text>: </xsl:text>
    </xsl:if>
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

<dtm:doc dtm:idref="refsynopsisdiv"/>
<xsl:template match="refsynopsisdiv" dtm:id="refsynopsisdiv">
  <xsl:variable name="preamble"
                select="title|subtitle|titleabbrev"/>
  <xsl:variable name="content"
                select="*[not(self::title or self::subtitle or self::titleabbrev)]"/>
  <fo:block
    xsl:use-attribute-sets="section.block.properties">
    <xsl:call-template name="handle.empty">
      <xsl:with-param name="titles">
        <xsl:call-template name="refsynopsisdiv.titlepage"/>
      </xsl:with-param>
      <xsl:with-param name="preamble" select="$preamble"/>
      <xsl:with-param name="content" select="$content"/>
    </xsl:call-template>
  </fo:block>
</xsl:template>

<dtm:doc dtm:idref="refsections"/>
<xsl:template match="refsection|refsect1|refsect2|refsect3" dtm:id="refsections">
  <xsl:variable name="preamble"
                select="title|subtitle|titleabbrev"/>
  <xsl:variable name="content"
                select="*[not(self::title or self::subtitle or self::titleabbrev)]"/>
  <fo:block
    xsl:use-attribute-sets="section.block.properties">
    <xsl:call-template name="handle.empty">
      <xsl:with-param name="titles">
        <xsl:call-template name="refsection.titlepage"/>
      </xsl:with-param>
      <xsl:with-param name="preamble" select="$preamble"/>
      <xsl:with-param name="content" select="$content"/>
    </xsl:call-template>
  </fo:block>
</xsl:template>

</xsl:stylesheet>