all-result.xsl 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. <body>
  7. <h2>软件信息清单</h2>
  8. <table border="1">
  9. <tr>
  10. <th>机芯:</th>
  11. <th>
  12. <xsl:value-of select="all/SW_Information/hardware"/>
  13. </th>
  14. </tr>
  15. <tr>
  16. <th>软件版本:</th>
  17. <th>
  18. <xsl:value-of select="all/SW_Information/SWVersion"/>
  19. </th>
  20. </tr>
  21. <tr>
  22. <th>机型:</th>
  23. <th>
  24. <xsl:value-of select="all/SW_Information/projectName"/>
  25. </th>
  26. </tr>
  27. <tr>
  28. <th>ProjectID:</th>
  29. <th>
  30. <xsl:value-of select="all/SW_Information/projectID"/>
  31. </th>
  32. </tr>
  33. <tr>
  34. <th>软件综合信息:</th>
  35. <th>
  36. <xsl:value-of select="all/SW_Information/SWInclude"/>
  37. </th>
  38. </tr>
  39. </table>
  40. <h2>测试结果汇总表</h2>
  41. <xsl:for-each select="results/item">
  42. <xsl:sort select="result"/>
  43. <table border="1" table-layout="fixed" word-wrap="break-word">
  44. <tr bgcolor="#9acd32">
  45. <th>子项名称</th>
  46. <th>子项结果</th>
  47. <th>结果数据</th>
  48. <th>日志路径</th>
  49. <th>备注</th>
  50. </tr>
  51. <tr>
  52. <td>
  53. <xsl:value-of select="name"/>
  54. </td>
  55. <xsl:choose>
  56. <xsl:when test="result = 'Fail'">
  57. <td bgcolor="#ff00ff">
  58. <xsl:value-of select="result"/>
  59. </td>
  60. </xsl:when>
  61. <xsl:otherwise>
  62. <td>
  63. <xsl:value-of select="result"/>
  64. </td>
  65. </xsl:otherwise>
  66. </xsl:choose>
  67. <td>
  68. <xsl:value-of select="data"/>
  69. </td>
  70. <td>
  71. <xsl:variable name="loghref" select="log" />
  72. <a href="{$loghref}">
  73. <xsl:value-of select="log" />
  74. </a>
  75. </td>
  76. <td>
  77. <xsl:value-of select="remark"/>
  78. </td>
  79. </tr>
  80. <xsl:variable name="cols" select="4" />
  81. <xsl:variable name="index" select="0" />
  82. <table border="1" table-layout="fixed" word-wrap="break-word">
  83. <th bgcolor="#9acd32">截图路径</th>
  84. <xsl:for-each select="screen[ (position() -1) mod $cols = 0]">
  85. <tr>
  86. <xsl:if test="position() = 1">
  87. <td>
  88. <xsl:variable name="screenhref" select="." />
  89. <a href="{$screenhref}">
  90. <xsl:value-of select="." />
  91. </a>
  92. </td>
  93. </xsl:if>
  94. <xsl:for-each select="following-sibling::screen[(position() - 1) &lt; $cols]">
  95. <td>
  96. <xsl:variable name="screenhref" select="." />
  97. <a href="{$screenhref}">
  98. <xsl:value-of select="." />
  99. </a>
  100. </td>
  101. </xsl:for-each>
  102. </tr>
  103. </xsl:for-each>
  104. </table>
  105. <tr border="1" bgcolor="#ff00ff"></tr>
  106. </table>
  107. </xsl:for-each>
  108. </body>
  109. </html>
  110. </xsl:template>
  111. </xsl:stylesheet>