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.

tags.xsl 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. <xsl:import href="../fsfe.xsl" />
  6. <xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />
  7. <!-- The top level element of the input file is "buildinfo" -->
  8. <xsl:template match="buildinfo">
  9. <xsl:apply-templates select="node()"/>
  10. </xsl:template>
  11. <xsl:key name="news-tags" match="/buildinfo/document/set/news/tags/tag[@key]"
  12. use="translate(@key,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
  13. <xsl:key name="news-tags" match="/buildinfo/document/set/news/tags/tag[not(@key)]"
  14. use="translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
  15. <xsl:key name="event-tags" match="/buildinfo/document/set/event/tags/tag[@key]"
  16. use="translate(@key,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
  17. <xsl:key name="event-tags" match="/buildinfo/document/set/event/tags/tag[not(@key)]"
  18. use="translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
  19. <xsl:template name="taglink">
  20. <xsl:param name="type"/>
  21. <xsl:variable name="keyname"
  22. select="translate(@key,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
  23. <xsl:variable name="tagname"
  24. select="translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
  25. <xsl:choose><xsl:when test="@key">
  26. <xsl:if test="generate-id() = generate-id(key($type, $keyname))">
  27. <li><a href="/tags/tagged-{$keyname}.html"><xsl:value-of select="."/></a></li>
  28. </xsl:if>
  29. </xsl:when><xsl:when test="@content and not(@content = '')">
  30. <xsl:if test="generate-id() = generate-id(key($type, $tagname))">
  31. <li><a href="/tags/tagged-{$tagname}.html"><xsl:value-of select="@content"/></a></li>
  32. </xsl:if>
  33. </xsl:when><xsl:otherwise>
  34. <xsl:if test="generate-id() = generate-id(key($type, $tagname))">
  35. <li><a href="/tags/tagged-{$tagname}.html"><xsl:value-of select="."/></a></li>
  36. </xsl:if>
  37. </xsl:otherwise></xsl:choose>
  38. </xsl:template>
  39. <!--display dynamic list of news items-->
  40. <xsl:template match="all-tags-news">
  41. <ul class="taglist">
  42. <xsl:for-each select="/buildinfo/document/set/news/tags/tag"><xsl:sort select="translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')" order="ascending" />
  43. <xsl:call-template name="taglink"><xsl:with-param name="type" select="'news-tags'"/></xsl:call-template>
  44. </xsl:for-each>
  45. </ul>
  46. </xsl:template>
  47. <!--display dynamic list of event items-->
  48. <xsl:template match="all-tags-events">
  49. <ul class="taglist">
  50. <xsl:for-each select="/buildinfo/document/set/event/tags/tag"><xsl:sort select="translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')" order="ascending" />
  51. <xsl:call-template name="taglink"><xsl:with-param name="type" select="'event-tags'"/></xsl:call-template>
  52. </xsl:for-each>
  53. </ul>
  54. </xsl:template>
  55. </xsl:stylesheet>