about summary refs log tree commit diff
path: root/src/log2xml/log2html.xsl
blob: 96691a6aefd7d5e0db4b7861ed8927b0d549676a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
  <xsl:template match="logfile">
    <html>
      <head>
        <link rel="stylesheet" href="logfile.css" type="text/css" />
        <title>Log File</title>
      </head>
      <body>
        <xsl:apply-templates/>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="nest">
    <div class='nesting'>
      <div class='head'>
        <code>
          <xsl:value-of select="head"/>
        </code>
      </div>
      <blockquote class='body'>
        <xsl:for-each select='line|nest'>
          <xsl:if test="position() != last()">
            <table class='x'>
              <tr class='x'>
                <td class='dummy'>
                  <div class='dummy' />
                </td>
                <td>
                  <xsl:apply-templates select='.'/>
                </td>
              </tr>
            </table>
          </xsl:if>
          <xsl:if test="position() = last()">
            <table class='y'>
              <tr class='y'>
                <td class='dummy'>
                  <div class='dummy' />
                </td>
                <td>
                  <xsl:apply-templates select='.'/>
                </td>
              </tr>
            </table>
          </xsl:if>
        </xsl:for-each>
      </blockquote>
    </div>
  </xsl:template>
  
  <xsl:template match="line">
    <code class='line'>
      <xsl:value-of select="."/>
    </code>
  </xsl:template>
  
</xsl:stylesheet>