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.

countries.xsl 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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="xml" encoding="UTF-8" indent="yes" />
  4. <!-- displays list of people for a given country (or a given team, i.e. "main") -->
  5. <xsl:template name="country-people-list">
  6. <xsl:param name="team"
  7. select="''" />
  8. <!-- parameter 'team' is your country code -->
  9. <xsl:param name="display" select="''" />
  10. <!-- parameter 'display' can limit the shown people to coordinators -->
  11. <xsl:variable name="teamcomma"><xsl:value-of select="$team" />,</xsl:variable>
  12. <xsl:variable name="commateam">, <xsl:value-of select="$team" /></xsl:variable>
  13. <xsl:element name="ul">
  14. <xsl:attribute name="class">people</xsl:attribute>
  15. <xsl:for-each select="/buildinfo/document/set/person[
  16. contains(@teams, $commateam) or
  17. contains(@teams, $teamcomma) or
  18. @teams=$team or
  19. $team='']">
  20. <xsl:sort select="@id" />
  21. <xsl:variable name="id" select="@id" />
  22. <!-- check whether person is a (deputy) coordinator -->
  23. <xsl:variable name="isCoordinator">
  24. <xsl:for-each select="function">
  25. <xsl:variable name="function">
  26. <xsl:value-of select="." />
  27. </xsl:variable>
  28. <!-- prepare translation pattern to lower-case country/team/whatever attribute value -->
  29. <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
  30. <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
  31. <xsl:choose>
  32. <!-- check whether is coord/deputy of the given country/group/team... -->
  33. <!-- we have to lower-case here because country attributes are written in uppercase -->
  34. <xsl:when test="translate(@*, $uppercase, $smallcase) = translate($team, $uppercase, $smallcase) and (contains($function, 'coordinator') or contains($function, 'deputy'))">
  35. <xsl:text>yes</xsl:text>
  36. </xsl:when>
  37. <xsl:otherwise>
  38. <!-- if person isn't a coordinator, the variable $isCoordinator is left blank -->
  39. <xsl:text></xsl:text>
  40. </xsl:otherwise>
  41. </xsl:choose>
  42. </xsl:for-each>
  43. </xsl:variable>
  44. <!-- only list if there is no display limitation set, or if person matches this criteria -->
  45. <xsl:if test="$display = '' or ($display = 'coordinators' and $isCoordinator = 'yes')">
  46. <xsl:element name="li">
  47. <xsl:element name="p">
  48. <!-- Picture -->
  49. <xsl:choose>
  50. <xsl:when test="avatar">
  51. <xsl:choose>
  52. <xsl:when test="link != ''">
  53. <xsl:element name="a">
  54. <xsl:attribute name="href">
  55. <xsl:value-of select="link" />
  56. </xsl:attribute>
  57. <xsl:element name="img">
  58. <xsl:attribute name="alt"><xsl:value-of select="name" /></xsl:attribute>
  59. <xsl:attribute name="src"><xsl:value-of select="avatar" /></xsl:attribute>
  60. </xsl:element>
  61. </xsl:element>
  62. </xsl:when>
  63. <xsl:otherwise>
  64. <xsl:element name="img">
  65. <xsl:attribute name="alt"><xsl:value-of select="name" /></xsl:attribute>
  66. <xsl:attribute name="src"><xsl:value-of select="avatar" /></xsl:attribute>
  67. </xsl:element>
  68. </xsl:otherwise>
  69. </xsl:choose>
  70. </xsl:when>
  71. <xsl:otherwise>
  72. <xsl:element name="img">
  73. <xsl:attribute name="alt"><xsl:value-of select="name" /></xsl:attribute>
  74. <xsl:attribute name="src">/graphics/default-avatar.png</xsl:attribute>
  75. </xsl:element>
  76. </xsl:otherwise>
  77. </xsl:choose>
  78. <!-- Name; if link is given show as link -->
  79. <xsl:element name="span">
  80. <xsl:attribute name="class">
  81. name</xsl:attribute>
  82. <xsl:choose>
  83. <xsl:when test="link != ''">
  84. <xsl:element name="a">
  85. <xsl:attribute name="href">
  86. <xsl:value-of select="link" />
  87. </xsl:attribute>
  88. <xsl:value-of select="name" />
  89. </xsl:element>
  90. </xsl:when>
  91. <xsl:otherwise>
  92. <xsl:value-of select="name" />
  93. </xsl:otherwise>
  94. </xsl:choose>
  95. </xsl:element>
  96. <!-- E-mail -->
  97. <xsl:element name="span">
  98. <xsl:attribute name="class">
  99. email</xsl:attribute>
  100. <xsl:if test="email != ''">
  101. <xsl:value-of select="email" />
  102. </xsl:if>
  103. </xsl:element>
  104. <!-- Functions -->
  105. <xsl:for-each select="function">
  106. <xsl:if test="position()!=1">
  107. <xsl:text>, </xsl:text>
  108. </xsl:if>
  109. <xsl:variable name="function">
  110. <xsl:value-of select="." />
  111. </xsl:variable>
  112. <xsl:apply-templates select="/buildinfo/document/set/function[@id=$function]/node()" />
  113. <xsl:if test="@country != ''">
  114. <xsl:text> </xsl:text>
  115. <xsl:variable name="country">
  116. <xsl:value-of select="@country" />
  117. </xsl:variable>
  118. <xsl:value-of select="/buildinfo/document/set/country[@id=$country]" />
  119. </xsl:if>
  120. <xsl:if test="@group != ''">
  121. <xsl:text> </xsl:text>
  122. <xsl:variable name="group">
  123. <xsl:value-of select="@group" />
  124. </xsl:variable>
  125. <xsl:value-of select="/buildinfo/document/set/group[@id=$group]" />
  126. </xsl:if>
  127. <xsl:if test="@project != ''">
  128. <xsl:text> </xsl:text>
  129. <xsl:variable name="project">
  130. <xsl:value-of select="@project" />
  131. </xsl:variable>
  132. <xsl:element name="a">
  133. <xsl:attribute name="href">
  134. <xsl:value-of select="/buildinfo/document/set/project[@id=$project]/link" />
  135. </xsl:attribute>
  136. <xsl:value-of select="/buildinfo/document/set/project[@id=$project]/title" />
  137. </xsl:element>
  138. </xsl:if>
  139. <xsl:if test="@volunteers != ''">
  140. <xsl:text> </xsl:text>
  141. <xsl:variable name="volunteers">
  142. <xsl:value-of select="@volunteers" />
  143. </xsl:variable>
  144. <xsl:apply-templates select="/buildinfo/document/set/volunteers[@id=$volunteers]/node()" />
  145. </xsl:if>
  146. <xsl:if test="@projects != ''">
  147. <xsl:text> </xsl:text>
  148. <xsl:variable name="projects">
  149. <xsl:value-of select="@projects" />
  150. </xsl:variable>
  151. <xsl:apply-templates select="/buildinfo/document/set/projects[@id=$projects]/node()" />
  152. </xsl:if>
  153. </xsl:for-each>
  154. <!-- Employee status for transparency reasons-->
  155. <!-- TODO: I (hugo) did this, so there s probably room for improvement -->
  156. <xsl:for-each select="employee">
  157. <xsl:element name="span">
  158. <xsl:choose>
  159. <xsl:when test="substring-before( . , '/') = 'full'">
  160. <xsl:attribute name="class">employee full</xsl:attribute>
  161. </xsl:when>
  162. <xsl:when test="substring-before( . , '/') = 'part'">
  163. <xsl:attribute name="class">employee part</xsl:attribute>
  164. </xsl:when>
  165. <xsl:when test="substring-before( . , '/') = 'freelancer'">
  166. <xsl:attribute name="class">employee freelancer</xsl:attribute>
  167. </xsl:when>
  168. <xsl:when test="substring-before( . , '/') = 'intern'">
  169. <xsl:attribute name="class">employee intern</xsl:attribute>
  170. </xsl:when>
  171. <xsl:otherwise></xsl:otherwise>
  172. </xsl:choose>
  173. <xsl:variable name="employee">
  174. <xsl:value-of select="." />
  175. </xsl:variable>
  176. <xsl:apply-templates select="/buildinfo/document/set/employee[@id=$employee]/node()" />
  177. </xsl:element>
  178. </xsl:for-each>
  179. <!-- / employee status -->
  180. </xsl:element>
  181. </xsl:element> <!-- /li -->
  182. </xsl:if>
  183. </xsl:for-each>
  184. </xsl:element>
  185. </xsl:template>
  186. <!-- showing a dropdown select menu with all countries in /tools/countries.**.xml -->
  187. <xsl:template name="country-list">
  188. <xsl:param name="required" select="'no'" />
  189. <xsl:element name="select">
  190. <xsl:attribute name="id">country</xsl:attribute>
  191. <xsl:attribute name="name">country</xsl:attribute>
  192. <!-- when called with the required="yes" param, add the attribute
  193. and an empty option -->
  194. <xsl:choose>
  195. <xsl:when test="$required = 'yes'">
  196. <xsl:attribute name="required">required</xsl:attribute>
  197. <option></option> <!-- this will force people to pick a choice actively -->
  198. </xsl:when>
  199. </xsl:choose>
  200. <!-- loop over all countries in countries.**.xml -->
  201. <xsl:for-each select="/buildinfo/document/set/country">
  202. <xsl:sort select="." lang="en" />
  203. <!-- will output: <option value="ZZ">Fooland</option> -->
  204. <xsl:element name="option">
  205. <xsl:attribute name="value">
  206. <xsl:value-of select="@id" />|<xsl:value-of select="." />
  207. </xsl:attribute>
  208. <xsl:value-of select="." />
  209. </xsl:element> <!-- /option -->
  210. </xsl:for-each>
  211. </xsl:element> <!-- /select -->
  212. </xsl:template>
  213. <!-- please note that there is also a country list ordered by continent (Europe or not) in static-elements.xsl -->
  214. </xsl:stylesheet>