File: preproc.xsl

package info (click to toggle)
refcard 13.1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,284 kB
  • sloc: python: 189; makefile: 108; sh: 6
file content (116 lines) | stat: -rw-r--r-- 3,555 bytes parent folder | download | duplicates (5)
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
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output
    method="xml" indent="yes" encoding="utf-8"
    doctype-system="http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
    doctype-public="-//OASIS//DTD DocBook XML V4.2//EN"/>

  <!-- disabled, not Debian-specific -->
  <xsl:template match="section[@id='samba']"/>

  <xsl:template match="section/glosslist">
    <xsl:if
	test="contains('dpkg apache2 configuration shell-commands apt', ../@id)">
      <xsl:processing-instruction name="custom-pagebreak"/>
    </xsl:if>
    <informaltable pgwide="1" frame="none" colsep="1" rowsep="1">
      <xsl:attribute name="id"><xsl:value-of
      select="../@id"/></xsl:attribute>
      <!-- role="small" is understood by dblatex -->
      <xsl:attribute name="role">
	<xsl:choose>
	  <xsl:when test="contains('el',
			  /article/@lang)">footnotesize</xsl:when>
	  <xsl:otherwise>small</xsl:otherwise>
	</xsl:choose>
      </xsl:attribute>
      <xsl:processing-instruction
	  name="dbfo">keep-together="always"</xsl:processing-instruction>
      <tgroup cols="2">
	<colspec align="justify" colwidth="2*" colname="l"/>
	<colspec align="justify" colwidth="3*" colname="r"/>
	<spanspec spanname="a" namest="l" nameend="r"/>
	<thead>
	  <row>
	    <entry spanname="a" align="center"><xsl:value-of
	    select="../title"/></entry>
	  </row>
	</thead>
	<tbody>
	  <xsl:apply-templates select="*"/>
	</tbody>
      </tgroup>
    </informaltable>
  </xsl:template>

  <xsl:template match="article">
    <article>
      <xsl:apply-templates select="*|@*|text()"/>
      <xsl:processing-instruction name="custom-notice"/>
      <ackno/> <!-- until dblatex understands the custom-notice -->
    </article>
  </xsl:template>

  <xsl:template match="articleinfo">
    <articleinfo>
      <xsl:copy-of select="document('refcard.dbk')/article/articleinfo/corpauthor"/>
      <xsl:copy-of select="document('refcard.dbk')/article/articleinfo/author"/>
      <revhistory>
	<revision>
	  <xsl:copy-of
	   select="document('refcard.dbk')/article/articleinfo/revhistory/revision[1]/revnumber"/>
	  <xsl:copy-of
	   select="document('refcard.dbk')/article/articleinfo/revhistory/revision[1]/date"/>
	</revision>
      </revhistory>
      <xsl:apply-templates select="*|@*|text()"/>
    </articleinfo>
  </xsl:template>

  <xsl:template match="glossentry">
    <row>
      <xsl:apply-templates select="*|@*|text()"/>
    </row>
  </xsl:template>

  <xsl:template match="glossterm">
    <entry align="left">
      <xsl:apply-templates select="*|@*|text()"/>
    </entry>
  </xsl:template>

  <xsl:template match="glossdef">
    <entry>
      <xsl:attribute name="align">
	<xsl:choose>
	  <xsl:when test="contains('ar fa he',
			  /article/@lang)">right</xsl:when>
	  <xsl:otherwise>left</xsl:otherwise>
	</xsl:choose>
      </xsl:attribute>
      <xsl:apply-templates select="para/*|para/@*|para/text()"/>
    </entry>
  </xsl:template>

  <xsl:template match="section">
    <xsl:apply-templates select="*|text()"/>
  </xsl:template>

  <xsl:template match="section/title"/>

  <!-- for the original English two copyright notes -->
  <xsl:template match="copyright[position() &gt; 2]">
    <xsl:if test="/article/@lang != 'en-GB'">
      <xsl:copy>
	<xsl:apply-templates select="*|@*|text()"/>
      </xsl:copy>
    </xsl:if>
  </xsl:template>

  <xsl:template match="*|@*|text()">
    <xsl:copy>
      <xsl:apply-templates select="*|@*|text()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>