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.

buildmenu.xsl 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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" version="1.0" encoding="UTF-8" indent="yes"/>
  4. <xsl:template match="localmenuset">
  5. <!-- Top level element of the local menu is "localmenuset" -->
  6. <xsl:element name="localmenuset">
  7. <!-- In "localmenuitems" each menu item is discribed in "menu" -->
  8. <!-- Only the English files defines the menu structure -->
  9. <xsl:element name="localmenuitems">
  10. <xsl:for-each select="/localmenuset/menuitem[@language='en']">
  11. <xsl:element name="menu">
  12. <xsl:attribute name="dir">
  13. <xsl:value-of select="dir" />
  14. </xsl:attribute>
  15. <xsl:attribute name="set">
  16. <xsl:choose>
  17. <xsl:when test="localmenu/@set">
  18. <xsl:value-of select="localmenu/@set" />
  19. </xsl:when>
  20. <xsl:otherwise>
  21. <xsl:text>0</xsl:text>
  22. </xsl:otherwise>
  23. </xsl:choose>
  24. </xsl:attribute>
  25. <xsl:attribute name="id">
  26. <xsl:value-of select="localmenu/@id" />
  27. </xsl:attribute>
  28. <xsl:attribute name="style">
  29. <xsl:choose>
  30. <xsl:when test="localmenu/@style">
  31. <xsl:value-of select="localmenu/@style" />
  32. </xsl:when>
  33. <xsl:otherwise>
  34. <xsl:text>default</xsl:text>
  35. </xsl:otherwise>
  36. </xsl:choose>
  37. </xsl:attribute>
  38. <xsl:value-of select="link" />
  39. </xsl:element>
  40. </xsl:for-each>
  41. </xsl:element>
  42. <!-- In "translate" each available tranlation is described in "lang_part" -->
  43. <xsl:element name="translate">
  44. <xsl:for-each select="/localmenuset/menuitem">
  45. <xsl:element name="lang_part">
  46. <xsl:attribute name="dir">
  47. <xsl:value-of select="dir" />
  48. </xsl:attribute>
  49. <xsl:attribute name="set">
  50. <xsl:choose>
  51. <xsl:when test="localmenu/@set">
  52. <xsl:value-of select="localmenu/@set" />
  53. </xsl:when>
  54. <xsl:otherwise>
  55. <xsl:text>0</xsl:text>
  56. </xsl:otherwise>
  57. </xsl:choose>
  58. </xsl:attribute>
  59. <xsl:attribute name="id">
  60. <xsl:value-of select="localmenu/@id" />
  61. </xsl:attribute>
  62. <xsl:attribute name="language">
  63. <xsl:value-of select="@language" />
  64. </xsl:attribute>
  65. <xsl:value-of select="localmenu" />
  66. </xsl:element>
  67. </xsl:for-each>
  68. </xsl:element>
  69. </xsl:element>
  70. </xsl:template>
  71. </xsl:stylesheet>