Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mk-tex-a4.xsl 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method="text" encoding="UTF-8"/>
  4. <xsl:param name="language"/>
  5. <xsl:param name="style"/>
  6. <xsl:template match="html">
  7. <xsl:apply-templates match="body"/>
  8. </xsl:template>
  9. <xsl:template match="head"/>
  10. <xsl:template match="body">
  11. <xsl:text>\documentclass[a4paper]{article}</xsl:text>
  12. <xsl:if test="$language='el'">\usepackage[english,greek]{babel}</xsl:if>
  13. <xsl:text>\usepackage{ucs}
  14. \usepackage[utf8x]{inputenc}
  15. \usepackage[T1]{fontenc}
  16. </xsl:text><xsl:if test="$language!='el'">\usepackage{helvet}</xsl:if><xsl:text>
  17. \usepackage{fancyhdr}
  18. \usepackage{multicol}
  19. </xsl:text><xsl:if test="$style='G'">\usepackage{graphics}
  20. \usepackage[absolute]{textpos}
  21. </xsl:if><xsl:text>
  22. % Page layout
  23. \setlength{\topmargin}{58pt}
  24. \setlength{\headheight}{12pt}
  25. \setlength{\headsep}{36pt}
  26. \setlength{\textheight}{530pt}
  27. \setlength{\footskip}{48pt}
  28. \setlength{\oddsidemargin}{-32pt}
  29. \setlength{\columnsep}{10pt}
  30. \setlength{\textwidth}{514pt}
  31. \raggedright
  32. % Header and footer
  33. \chead{}
  34. \rhead{\fontseries{bc}\selectfont (</xsl:text>
  35. <xsl:value-of select="$language"/>
  36. <xsl:text>)}
  37. \cfoot{}
  38. \rfoot{}
  39. \renewcommand{\headrulewidth}{0pt}
  40. \renewcommand{\footrulewidth}{0pt}
  41. % No chapter numbering
  42. \setcounter{secnumdepth}{-2}
  43. \renewcommand{\familydefault}{\sfdefault}
  44. % Section and subsection formatting
  45. \makeatletter
  46. \renewcommand{\section}{\@startsection{section}{2}{\z@}%
  47. {-3.5ex \@plus -1ex \@minus -.2ex}%
  48. {2.3ex \@plus.2ex}%
  49. {\fontsize{12pt}{14.4pt}\selectfont\bfseries\itshape}}
  50. \renewcommand{\subsection}{\@startsection{section}{3}{\z@}%
  51. {-3ex \@plus -1ex \@minus -.2ex}%
  52. {3pt}%
  53. {\fontsize{11pt}{12pt}\selectfont\bfseries\itshape}}
  54. \makeatother
  55. </xsl:text>
  56. <xsl:apply-templates select="a[@id='moreinfo']"/>
  57. <xsl:apply-templates select="address"/>
  58. <xsl:text>\begin{document}</xsl:text>
  59. <xsl:text>\pagestyle{fancy}</xsl:text>
  60. <!-- Folders -->
  61. <xsl:apply-templates select="div[@id='fsfe']"/>
  62. <xsl:apply-templates select="div[@id='contribute']"/>
  63. <xsl:apply-templates select="div[@id='free_software']"/>
  64. <!-- Leaflets -->
  65. <xsl:apply-templates select="h1"/>
  66. <xsl:text>\begin{bfseries}</xsl:text>
  67. <xsl:apply-templates select="p[@class='background']"/>
  68. <xsl:text>\end{bfseries}</xsl:text>
  69. <xsl:text>\begin{multicols}{2}</xsl:text>
  70. <xsl:apply-templates select="h2|p[not(@class='background')]|ul"/>
  71. <xsl:text>\end{multicols}</xsl:text>
  72. <!-- End of document -->
  73. <xsl:text>\end{document}</xsl:text>
  74. </xsl:template>
  75. <xsl:template match="a[@id='moreinfo']">
  76. <xsl:text>\lhead{</xsl:text>
  77. <xsl:if test="$style='G'">
  78. <xsl:text>\begin{textblock*}{\paperwidth}(0pt,0pt)</xsl:text>
  79. <xsl:text>\includegraphics{background-a4.pdf}</xsl:text>
  80. <xsl:text>\end{textblock*}</xsl:text>
  81. </xsl:if>
  82. <xsl:text>\fontseries{bc}\selectfont </xsl:text>
  83. <xsl:value-of select="node()"/>
  84. <xsl:text>}</xsl:text>
  85. </xsl:template>
  86. <xsl:template match="address">
  87. <xsl:text>\lfoot{\fontsize{8pt}{9.5pt}\selectfont </xsl:text>
  88. <xsl:apply-templates select="node()"/>
  89. <!-- Disclaimer -->
  90. <xsl:if test="$language!='de' and $language!='en' and $language!='es' and $language!='it'">
  91. <xsl:if test="$language='el'">\selectlanguage{english}</xsl:if>
  92. <xsl:text>This is an inofficial translation. Please see </xsl:text>
  93. <xsl:text>http://www.fsfe.org/about/printable/printable.en.html</xsl:text>
  94. <xsl:text> for the original text.</xsl:text>
  95. </xsl:if>
  96. <xsl:text>}</xsl:text>
  97. </xsl:template>
  98. <xsl:template match="div">
  99. <xsl:if test="@id='free_software'">
  100. <xsl:text>\break</xsl:text>
  101. </xsl:if>
  102. <xsl:if test="not(@id='fsfe')">
  103. <xsl:apply-templates select="h1"/>
  104. </xsl:if>
  105. <xsl:text>\begin{bfseries}</xsl:text>
  106. <xsl:apply-templates select="p[@class='background']"/>
  107. <xsl:text>\end{bfseries}\smallskip</xsl:text>
  108. <xsl:apply-templates select="h2|p[not(@class='background')]|ul"/>
  109. </xsl:template>
  110. <xsl:template match="h1">
  111. <xsl:text>\section{</xsl:text>
  112. <xsl:apply-templates select="node()"/>
  113. <xsl:text>}</xsl:text>
  114. </xsl:template>
  115. <xsl:template match="h2">
  116. <xsl:text>\subsection{</xsl:text>
  117. <xsl:apply-templates select="node()"/>
  118. <xsl:text>}</xsl:text>
  119. </xsl:template>
  120. <xsl:template match="p">
  121. <xsl:apply-templates select="node()"/>
  122. <xsl:text>\par </xsl:text>
  123. </xsl:template>
  124. <xsl:template match="ul">
  125. <xsl:text>\begin{itemize}</xsl:text>
  126. <xsl:text>\itemsep 3pt</xsl:text>
  127. <xsl:apply-templates select="li"/>
  128. <xsl:text>\end{itemize}</xsl:text>
  129. </xsl:template>
  130. <xsl:template match="li">
  131. <xsl:text>\item </xsl:text>
  132. <xsl:apply-templates select="node()"/>
  133. </xsl:template>
  134. <xsl:template match="b">
  135. <xsl:text>{\bfseries </xsl:text>
  136. <xsl:apply-templates select="node()"/>
  137. <xsl:text>}</xsl:text>
  138. </xsl:template>
  139. <xsl:template match="latin">
  140. <xsl:text>{\selectlanguage{english}</xsl:text>
  141. <xsl:apply-templates select="node()"/>
  142. <xsl:text>}</xsl:text>
  143. </xsl:template>
  144. <xsl:template match="a">
  145. <xsl:apply-templates select="node()"/>
  146. </xsl:template>
  147. <xsl:template match="br">\\</xsl:template>
  148. <xsl:template match="timestamp"/>
  149. <xsl:template match="translator"/>
  150. </xsl:stylesheet>