case_result_detail.xsl 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. <xsl:template match="/">
  5. <html>
  6. <h2>Case详细步骤结果</h2>
  7. <body>
  8. <div>
  9. <xsl:for-each select="results/item">
  10. <xsl:sort select="result"/>
  11. <table border="1" table-layout="fixed" word-wrap="break-word">
  12. <tr bgcolor="#9acd32">
  13. <th>子项名称</th>
  14. <th>子项结果</th>
  15. <th>结果数据</th>
  16. <th>日志路径</th>
  17. <th>备注</th>
  18. </tr>
  19. <tr>
  20. <td>
  21. <xsl:value-of select="name"/>
  22. </td>
  23. <xsl:choose>
  24. <xsl:when test="result = 'Fail'">
  25. <td bgcolor="#ff00ff">
  26. <xsl:value-of select="result"/>
  27. </td>
  28. </xsl:when>
  29. <xsl:otherwise>
  30. <td>
  31. <xsl:value-of select="result"/>
  32. </td>
  33. </xsl:otherwise>
  34. </xsl:choose>
  35. <td>
  36. <xsl:value-of select="data"/>
  37. </td>
  38. <td>
  39. <xsl:variable name="loghref" select="log" />
  40. <a href="{$loghref}">
  41. <xsl:value-of select="log" />
  42. </a>
  43. </td>
  44. <td>
  45. <xsl:value-of select="remark"/>
  46. </td>
  47. </tr>
  48. <xsl:variable name="cols" select="4" />
  49. <xsl:variable name="index" select="0" />
  50. <table border="1" table-layout="fixed" word-wrap="break-word">
  51. <th bgcolor="#9acd32">截图路径</th>
  52. <xsl:for-each select="screen[ (position() -1) mod $cols = 0]">
  53. <tr>
  54. <xsl:if test="position() = 1">
  55. <td>
  56. <xsl:variable name="screenhref" select="." />
  57. <a href="{$screenhref}">
  58. <xsl:value-of select="." />
  59. </a>
  60. </td>
  61. </xsl:if>
  62. <xsl:for-each select="following-sibling::screen[(position() - 1) &lt; $cols]">
  63. <td>
  64. <xsl:variable name="screenhref" select="." />
  65. <a href="{$screenhref}">
  66. <xsl:value-of select="." />
  67. </a>
  68. </td>
  69. </xsl:for-each>
  70. </tr>
  71. </xsl:for-each>
  72. </table>
  73. <tr border="1" bgcolor="#ff00ff"></tr>
  74. </table>
  75. </xsl:for-each>
  76. </div>
  77. </body>
  78. </html>
  79. </xsl:template>
  80. </xsl:stylesheet>