Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/ https://fsfe.org
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.

index.xsl 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="1.0"
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4. xmlns:dt="http://xsltsl.org/date-time"
  5. exclude-result-prefixes="dt">
  6. <xsl:import href="tools/xsltsl/date-time.xsl" />
  7. <xsl:import href="tools/xsltsl/tagging.xsl" />
  8. <xsl:import href="tools/xsltsl/translations.xsl" />
  9. <xsl:import href="tools/xsltsl/static-elements.xsl" />
  10. <xsl:import href="tools/xsltsl/quotes.xsl" />
  11. <xsl:output method="xml" encoding="UTF-8" indent="yes" />
  12. <!-- The top level element of the input file is "buildinfo" -->
  13. <xsl:template match="buildinfo">
  14. <xsl:apply-templates select="node()"/>
  15. </xsl:template>
  16. <xsl:template match="/html/body">
  17. <xsl:copy>
  18. <div id="frontpage">
  19. <xsl:apply-templates />
  20. </div>
  21. </xsl:copy>
  22. </xsl:template>
  23. <xsl:template match="quote-box">
  24. <xsl:call-template name="quote-box">
  25. <xsl:with-param name="tag" select="@tag" />
  26. </xsl:call-template>
  27. </xsl:template>
  28. <xsl:template match="label-ourwork2011">
  29. <xsl:call-template name="gettext">
  30. <xsl:with-param name="id" select="'ourwork2011'" />
  31. </xsl:call-template>
  32. </xsl:template>
  33. <!--display dynamic list of news items-->
  34. <xsl:template match="all-news">
  35. <xsl:call-template name="fetch-news">
  36. <xsl:with-param name="tag">front-page</xsl:with-param>
  37. <xsl:with-param name="nb-items" select="5" />
  38. <xsl:with-param name="show-date" select="'no'" />
  39. </xsl:call-template>
  40. <xsl:element name="p">
  41. <xsl:element name="a">
  42. <xsl:attribute name="href">/news/news.html</xsl:attribute>
  43. <xsl:call-template name="more-label" /><xsl:text>…</xsl:text>
  44. </xsl:element>
  45. </xsl:element>
  46. </xsl:template>
  47. <!--display dynamic list of newsletters items-->
  48. <xsl:template match="all-newsletters">
  49. <xsl:call-template name="fetch-newsletters">
  50. <xsl:with-param name="nb-items" select="2" />
  51. </xsl:call-template>
  52. </xsl:template>
  53. <!--display dynamic list of event items-->
  54. <xsl:template match="all-events">
  55. <!-- Current events -->
  56. <xsl:call-template name="fetch-events">
  57. <xsl:with-param name="wanted-time" select="'present'" />
  58. <xsl:with-param name="tag">front-page</xsl:with-param>
  59. <xsl:with-param name="display-details" select="'yes'" />
  60. </xsl:call-template>
  61. <!-- Future events -->
  62. <xsl:call-template name="fetch-events">
  63. <xsl:with-param name="wanted-time" select="'future'" />
  64. <xsl:with-param name="tag">front-page</xsl:with-param>
  65. <xsl:with-param name="display-details" select="'yes'" />
  66. <xsl:with-param name="nb-items" select="4" />
  67. </xsl:call-template>
  68. <xsl:element name="p">
  69. <xsl:element name="a">
  70. <xsl:attribute name="href">/events/events.html</xsl:attribute>
  71. <xsl:call-template name="more-label" /><xsl:text>…</xsl:text>
  72. </xsl:element>
  73. </xsl:element>
  74. </xsl:template>
  75. <!-- display campaign box 3 -->
  76. <xsl:template match="campaign-box-3">
  77. <xsl:element name="a">
  78. <xsl:attribute name="href">/campaigns/ilovefs/ilovefs<xsl:value-of select="/buildinfo/@language" />.html</xsl:attribute>
  79. <xsl:variable name="lang" select="/buildinfo/@language" />
  80. <xsl:variable name="img-path"
  81. select="concat( '/campaigns/valentine/valentine-358x60-', substring($lang, 2, 2) , '.png' )" />
  82. <xsl:element name="img">
  83. <xsl:attribute name="src">
  84. <xsl:value-of select="$img-path" />
  85. </xsl:attribute>
  86. <!-- And on error (if previous file does not exist), we load our default image -->
  87. <xsl:attribute name="onerror">
  88. <xsl:text>this.src='/campaigns/valentine/valentine-358x60-en.png';</xsl:text>
  89. </xsl:attribute>
  90. <xsl:attribute name="alt"
  91. value="No picture" />
  92. </xsl:element>
  93. </xsl:element>
  94. </xsl:template>
  95. <!-- display campaign box 4 -->
  96. <xsl:template match="campaign-box4">
  97. <div id="campaign-box-4">
  98. <!--
  99. Here are two codes snippets that will provide for a graphical and a text banner.
  100. /!\ comment out one of the two, you probably only want one banner on the front page.
  101. -->
  102. <!-- graphical banner -->
  103. <!--<a href="/campaigns/ilovefs/ilovefs.html">
  104. <img src="/graphics/valentine.png" />
  105. </a>-->
  106. <!--
  107. Text banner
  108. The ids used here are needed to fetch the correct texts in /tools/texts-content.**.xml
  109. /!\ the text with given IDs *must* exist there!
  110. -->
  111. <div class="banner-border">
  112. <p>
  113. <xsl:call-template name="gettext">
  114. <xsl:with-param name="id" select="'cb-restricted-boot'" />
  115. </xsl:call-template>
  116. <xsl:text> </xsl:text>
  117. <a href="/campaigns/generalpurposecomputing/secure-boot-analysis.html">
  118. <xsl:call-template name="gettext">
  119. <xsl:with-param name="id" select="'cb-restricted-boot-link'" />
  120. </xsl:call-template>
  121. </a>
  122. </p>
  123. </div>
  124. </div>
  125. </xsl:template>
  126. <!--display labels-->
  127. <!--translated word "newsletter"-->
  128. <xsl:template match="newsletter-label">
  129. <xsl:call-template name="gettext">
  130. <xsl:with-param name="id" select="'newsletter'" />
  131. </xsl:call-template>
  132. </xsl:template>
  133. <!--translated sentence "receive-newsletter"-->
  134. <xsl:template match="receive-newsletter">
  135. <xsl:call-template name="gettext">
  136. <xsl:with-param name="id" select="'receive-newsletter'" />
  137. </xsl:call-template>
  138. </xsl:template>
  139. <!--translated word "news"-->
  140. <xsl:template match="news-label">
  141. <xsl:call-template name="gettext">
  142. <xsl:with-param name="id" select="'news'" />
  143. </xsl:call-template>
  144. </xsl:template>
  145. <!--translated word "events"-->
  146. <xsl:template match="events-label">
  147. <xsl:call-template name="gettext">
  148. <xsl:with-param name="id" select="'events'" />
  149. </xsl:call-template>
  150. </xsl:template>
  151. <!--translated word "more"-->
  152. <xsl:template match="more-label">
  153. <xsl:call-template name="more-label" /><xsl:text>…</xsl:text>
  154. </xsl:template>
  155. <xsl:template name="more-label">
  156. <xsl:call-template name="gettext">
  157. <xsl:with-param name="id" select="'more'" />
  158. </xsl:call-template>
  159. </xsl:template>
  160. <!--translated word "donate"-->
  161. <xsl:template match="donate-label">
  162. <xsl:call-template name="gettext">
  163. <xsl:with-param name="id" select="'donate'" />
  164. </xsl:call-template>
  165. </xsl:template>
  166. <!--translated word "join"-->
  167. <xsl:template match="join-label">
  168. <xsl:call-template name="gettext">
  169. <xsl:with-param name="id" select="'join'" />
  170. </xsl:call-template>
  171. </xsl:template>
  172. <!--translated word "support"-->
  173. <xsl:template match="support-label">
  174. <xsl:call-template name="gettext">
  175. <xsl:with-param name="id" select="'support'" />
  176. </xsl:call-template>
  177. </xsl:template>
  178. <xsl:template match="about-work-label">
  179. <xsl:call-template name="gettext">
  180. <xsl:with-param name="id" select="'about-work'" />
  181. </xsl:call-template>
  182. </xsl:template>
  183. <xsl:template match="subscribe-nl">
  184. <xsl:call-template name="subscribe-nl" />
  185. </xsl:template>
  186. <!-- Do not copy <set> or <text> to output at all -->
  187. <xsl:template match="set | tags | text"/>
  188. <!-- For all other nodes, copy verbatim -->
  189. <xsl:template match="@* | node()" priority="-1">
  190. <xsl:copy>
  191. <xsl:apply-templates select="@* | node()"/>
  192. </xsl:copy>
  193. </xsl:template>
  194. <xsl:template match="@dt:*">
  195. <xsl:attribute name="{local-name()}">
  196. <xsl:value-of select="." />
  197. </xsl:attribute>
  198. </xsl:template>
  199. </xsl:stylesheet>