xbel.xsl 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. version='1.0'>
  4. <!-- ********************************************************************
  5. $Id: xbel.xsl 6910 2007-06-28 23:23:30Z xmldoc $
  6. ********************************************************************
  7. This file is part of the XSL DocBook Stylesheet distribution.
  8. See ../README or http://docbook.sf.net/release/xsl/current/ for
  9. copyright and other information.
  10. ******************************************************************** -->
  11. <!-- ==================================================================== -->
  12. <xsl:output method="xml"/>
  13. <!-- ==================================================================== -->
  14. <xsl:template match="xbel">
  15. <ul>
  16. <xsl:apply-templates/>
  17. </ul>
  18. </xsl:template>
  19. <!-- Only partial support for xbel elements -->
  20. <xsl:template match="xbel/info|xbel/title|xbel/desc|
  21. xbel/alias|xbel/separator">
  22. <!-- No op -->
  23. </xsl:template>
  24. <xsl:template match="folder">
  25. <li>
  26. <xsl:apply-templates select="title"/>
  27. <ul>
  28. <xsl:apply-templates select="folder|bookmark"/>
  29. </ul>
  30. </li>
  31. </xsl:template>
  32. <xsl:template match="folder/title">
  33. <b><xsl:apply-templates/></b>
  34. </xsl:template>
  35. <xsl:template match="bookmark">
  36. <li>
  37. <a href="{@href}" target="_top">
  38. <xsl:apply-templates select="title"/>
  39. </a>
  40. </li>
  41. </xsl:template>
  42. <xsl:template match="bookmark/title">
  43. <xsl:apply-templates/>
  44. </xsl:template>
  45. <!-- ==================================================================== -->
  46. <xsl:template match="xbel" mode="dynamic">
  47. <ul>
  48. <xsl:apply-templates mode="dynamic"/>
  49. </ul>
  50. </xsl:template>
  51. <xsl:template match="info" mode="dynamic">
  52. </xsl:template>
  53. <xsl:template match="folder" mode="dynamic">
  54. <li>
  55. <xsl:apply-templates select="title" mode="dynamic"/>
  56. <ul style="display:none" id="{@id}">
  57. <xsl:apply-templates select="folder|bookmark" mode="dynamic"/>
  58. </ul>
  59. </li>
  60. </xsl:template>
  61. <xsl:template match="folder/title" mode="dynamic">
  62. <b>
  63. <span>
  64. <xsl:choose>
  65. <xsl:when test="../@id">
  66. <xsl:attribute name="onClick">
  67. <xsl:text>toggleList('</xsl:text>
  68. <xsl:value-of select="../@id"/>
  69. <xsl:text>')</xsl:text>
  70. </xsl:attribute>
  71. <xsl:attribute name="class">exlist</xsl:attribute>
  72. <xsl:attribute name="style">color: blue</xsl:attribute>
  73. <xsl:apply-templates mode="dynamic"/>
  74. </xsl:when>
  75. <xsl:otherwise>
  76. <xsl:apply-templates mode="dynamic"/>
  77. </xsl:otherwise>
  78. </xsl:choose>
  79. </span>
  80. </b>
  81. </xsl:template>
  82. <xsl:template match="bookmark" mode="dynamic">
  83. <li>
  84. <a href="{@href}" target="_top">
  85. <xsl:apply-templates select="title" mode="dynamic"/>
  86. </a>
  87. </li>
  88. </xsl:template>
  89. <xsl:template match="bookmark/title" mode="dynamic">
  90. <xsl:apply-templates mode="dynamic"/>
  91. </xsl:template>
  92. <!-- ==================================================================== -->
  93. </xsl:stylesheet>