main.xsl 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:func="http://exslt.org/functions" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="exsl func" extension-element-prefixes="exsl func str">
  3. <xsl:output method="xml"/>
  4. <func:function name="func:iif">
  5. <!-- like a sql iif(coondition, ifTrue, ifFalse)
  6. returns ifTrue if condition=true() else ifFalse
  7. -->
  8. <xsl:param name="condition"/>
  9. <xsl:param name="ifTrue"/>
  10. <xsl:param name="ifFalse"/>
  11. <xsl:variable name="result">
  12. <xsl:choose>
  13. <xsl:when test="$condition=true()">
  14. <xsl:value-of select="$ifTrue"/>
  15. </xsl:when>
  16. <xsl:otherwise>
  17. <xsl:value-of select="$ifFalse"/>
  18. </xsl:otherwise>
  19. </xsl:choose>
  20. </xsl:variable>
  21. <func:result select="$result"/>
  22. </func:function>
  23. <xsl:template match="/">
  24. <html>
  25. <body>
  26. <table width="100%%" style="border: 1px solid rgb(204, 204, 204);font: 13px Verdana">
  27. <thead style="background-color: silver">
  28. <tr>
  29. <td/>
  30. <td>Server</td>
  31. <td>Description</td>
  32. <td>Status</td>
  33. <!--<td>Grid</td>
  34. <td>TEMP</td>-->
  35. </tr>
  36. </thead>
  37. <tbody>
  38. <xsl:for-each select="/root/data/servers/group">
  39. <tr>
  40. <td colspan="9" style="margin-left:20px;font-weight:bold;background-color:#eee;">
  41. <xsl:value-of select="@desc"/>
  42. <span> [<xsl:value-of select="count(server)"/>]</span>
  43. </td>
  44. </tr>
  45. <xsl:for-each select="server">
  46. <tr>
  47. <td style="width:20px">
  48. <a href="{@url}/server_status">
  49. <img src="{@url}/domainresource/static/graphics/favicon.ico" height="16" width="16" style="margin-right: 10px;"/>
  50. </a>
  51. </td>
  52. <td>
  53. <a href="{@url}">
  54. <xsl:value-of select="@url"/>
  55. </a>
  56. </td>
  57. <td align="right">
  58. <xsl:value-of select="@description"/>
  59. </td>
  60. <td>
  61. <xsl:choose>
  62. <xsl:when test="@error='true' and @message!='not contacted'">
  63. <xsl:attribute name="style">background-color: rgb(255, 136, 136)</xsl:attribute>
  64. <xsl:attribute name="colspan">20</xsl:attribute>
  65. <xsl:value-of select="@message"/>
  66. </xsl:when>
  67. <xsl:when test="@error='true' and @message='not contacted'">
  68. <xsl:attribute name="style">background-color: rgb(230, 230, 210)</xsl:attribute>
  69. <xsl:attribute name="colspan">20</xsl:attribute>
  70. <xsl:value-of select="@message"/>
  71. </xsl:when>
  72. <xsl:otherwise>
  73. <xsl:attribute name="style">background-color: rgb(136, 251, 102)</xsl:attribute>
  74. <xsl:text>OK</xsl:text>
  75. </xsl:otherwise>
  76. </xsl:choose>
  77. </td>
  78. <!--
  79. <xsl:if test="@error!='true'">
  80. <td align="center">
  81. <a href="vlx://grid?name=MyGrid&amp;server={@name}">[grid]</a>
  82. </td>
  83. <td align="center">
  84. <a href="/grid?name=MyGrid&amp;server={@name}">[grid]</a>
  85. </td>
  86. </xsl:if>
  87. -->
  88. </tr>
  89. </xsl:for-each>
  90. </xsl:for-each>
  91. </tbody>
  92. </table>
  93. </body>
  94. </html>
  95. </xsl:template>
  96. </xsl:stylesheet>