You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
4.3 KiB

  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method='html' encoding="UTF-8"
  4. doctype-public="-//W3C//DTD HTML 4.01//EN"
  5. doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
  6. <xsl:template match="logfile">
  7. <html>
  8. <head>
  9. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
  10. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  11. <script type="text/javascript" src="treebits.js" />
  12. <link rel="stylesheet" href="logfile.css" type="text/css" />
  13. <title>Log File</title>
  14. </head>
  15. <body>
  16. <h1>VM build log</h1>
  17. <p>
  18. <a href="javascript:" class="logTreeExpandAll">Expand all</a> |
  19. <a href="javascript:" class="logTreeCollapseAll">Collapse all</a>
  20. </p>
  21. <ul class='toplevel'>
  22. <xsl:for-each select='line|nest'>
  23. <li>
  24. <xsl:apply-templates select='.'/>
  25. </li>
  26. </xsl:for-each>
  27. </ul>
  28. <xsl:if test=".//*[@image]">
  29. <h1>Screenshots</h1>
  30. <ul class="vmScreenshots">
  31. <xsl:for-each select='.//*[@image]'>
  32. <li><a href="{@image}"><xsl:value-of select="@image" /></a></li>
  33. </xsl:for-each>
  34. </ul>
  35. </xsl:if>
  36. </body>
  37. </html>
  38. </xsl:template>
  39. <xsl:template match="nest">
  40. <!-- The tree should be collapsed by default if all children are
  41. unimportant or if the header is unimportant. -->
  42. <xsl:variable name="collapsed" select="not(./head[@expanded]) and count(.//*[@error]) = 0"/>
  43. <xsl:variable name="style"><xsl:if test="$collapsed">display: none;</xsl:if></xsl:variable>
  44. <xsl:if test="line|nest">
  45. <a href="javascript:" class="logTreeToggle">
  46. <xsl:choose>
  47. <xsl:when test="$collapsed"><xsl:text>+</xsl:text></xsl:when>
  48. <xsl:otherwise><xsl:text>-</xsl:text></xsl:otherwise>
  49. </xsl:choose>
  50. </a>
  51. <xsl:text> </xsl:text>
  52. </xsl:if>
  53. <xsl:apply-templates select='head'/>
  54. <!-- Be careful to only generate <ul>s if there are <li>s, otherwise it’s malformed. -->
  55. <xsl:if test="line|nest">
  56. <ul class='nesting' style="{$style}">
  57. <xsl:for-each select='line|nest'>
  58. <!-- Is this the last line? If so, mark it as such so that it
  59. can be rendered differently. -->
  60. <xsl:variable name="class"><xsl:choose><xsl:when test="position() != last()">line</xsl:when><xsl:otherwise>lastline</xsl:otherwise></xsl:choose></xsl:variable>
  61. <li class='{$class}'>
  62. <span class='lineconn' />
  63. <span class='linebody'>
  64. <xsl:apply-templates select='.'/>
  65. </span>
  66. </li>
  67. </xsl:for-each>
  68. </ul>
  69. </xsl:if>
  70. </xsl:template>
  71. <xsl:template match="head|line">
  72. <code>
  73. <xsl:if test="@error">
  74. <xsl:attribute name="class">errorLine</xsl:attribute>
  75. </xsl:if>
  76. <xsl:if test="@warning">
  77. <xsl:attribute name="class">warningLine</xsl:attribute>
  78. </xsl:if>
  79. <xsl:if test="@priority = 3">
  80. <xsl:attribute name="class">prio3</xsl:attribute>
  81. </xsl:if>
  82. <xsl:if test="@type = 'serial'">
  83. <xsl:attribute name="class">serial</xsl:attribute>
  84. </xsl:if>
  85. <xsl:if test="@machine">
  86. <xsl:choose>
  87. <xsl:when test="@type = 'serial'">
  88. <span class="machine"><xsl:value-of select="@machine"/># </span>
  89. </xsl:when>
  90. <xsl:otherwise>
  91. <span class="machine"><xsl:value-of select="@machine"/>: </span>
  92. </xsl:otherwise>
  93. </xsl:choose>
  94. </xsl:if>
  95. <xsl:choose>
  96. <xsl:when test="@image">
  97. <a href="{@image}"><xsl:apply-templates/></a>
  98. </xsl:when>
  99. <xsl:otherwise>
  100. <xsl:apply-templates/>
  101. </xsl:otherwise>
  102. </xsl:choose>
  103. </code>
  104. </xsl:template>
  105. <xsl:template match="storeref">
  106. <em class='storeref'>
  107. <span class='popup'><xsl:apply-templates/></span>
  108. <span class='elided'>/...</span><xsl:apply-templates select='name'/><xsl:apply-templates select='path'/>
  109. </em>
  110. </xsl:template>
  111. </xsl:stylesheet>