render-toolbar.xslt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: HTS
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  9. <xsl:import href="render-menu.xslt"/>
  10. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
  11. <xsl:template match="/">
  12. <xsl:call-template name="renderToolbar"/>
  13. </xsl:template>
  14. <xsl:template name="renderToolbar">
  15. <xsl:param name="toolbar" select="/root/input/toolbar"/>
  16. <div id="leftcontent" role="toolbar">
  17. <xsl:for-each select="$toolbar/item">
  18. <xsl:if test="starts-with(./@type,'combo') or ./@type='link' or ./@type='button'">
  19. <!-- render a separator -->
  20. <xsl:if test="./@separatorBefore='true'">
  21. <div role="separator" class="separator"/>
  22. </xsl:if>
  23. <xsl:if test="./@labelBefore">
  24. <div>
  25. <table class="labelTable">
  26. <tr>
  27. <td class="labelCell">
  28. <xsl:value-of select="./@labelBefore"/>
  29. </td>
  30. </tr>
  31. </table>
  32. </div>
  33. </xsl:if>
  34. <div class="dropDownButton" onmouseover="javascript:this.className='dropdownButtonMouseOver'" onmouseout="javascript:this.className='dropdownButtonMouseOut'">
  35. <!-- add some extra mouse down/mouse up handlers for combo box/combo button menus -->
  36. <xsl:if test="./@type='button' or ./@type='comboButton'">
  37. <xsl:attribute name="onmousedown">javascript:this.className='dropDownButtonMouseDown'</xsl:attribute>
  38. <xsl:attribute name="onmouseup">javascript:this.className='dropDownButton'</xsl:attribute>
  39. </xsl:if>
  40. <xsl:choose>
  41. <!-- render a combo box/combo button menu -->
  42. <xsl:when test="starts-with(./@type,'combo')">
  43. <xsl:call-template name="renderMenu">
  44. <xsl:with-param name="menu" select="./menu"/>
  45. <xsl:with-param name="customName" select="concat('_THIS_',./menu/@id)"/>
  46. <xsl:with-param name="menuType" select="./@type"/>
  47. </xsl:call-template>
  48. </xsl:when>
  49. <!-- render a link -->
  50. <xsl:when test="./@type='link'">
  51. <a href="{./action}"><xsl:value-of select="./name"/></a>
  52. </xsl:when>
  53. <!-- render a button, a button can have a title or an image -->
  54. <xsl:when test="./@type='button' or ./@type='comboButton'">
  55. <div border="10" onkeypress="if (_hts_getKeyCode(event) == 13 || _hts_getKeyCode(event) == 32) {./action}" onclick="{./action}">
  56. <xsl:choose>
  57. <xsl:when test="./image">
  58. <img tabindex="0" border="0" src="_THIS?frag-resource=/{./image}/THIS_" alt="{./name}" title="{./name}">
  59. <xsl:if test="./@type='button'">
  60. <xsl:attribute name="role">button</xsl:attribute>
  61. </xsl:if>
  62. </img>
  63. </xsl:when>
  64. <xsl:otherwise><xsl:value-of select="./name"/></xsl:otherwise>
  65. </xsl:choose>
  66. </div>
  67. </xsl:when>
  68. </xsl:choose>
  69. </div>
  70. </xsl:if>
  71. </xsl:for-each>
  72. </div>
  73. </xsl:template>
  74. </xsl:stylesheet>