summaryrefslogtreecommitdiffstats
path: root/klinkstatus/data/styles/results_stylesheet.xsl
blob: d0b0c10d234c28153bd0175f88d98718002b65cc (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output method="html" />
    
    <xsl:template match="/klinkstatus">
        <html>
            <body>
                
                <strong>URL: </strong>
                <xsl:value-of select="/klinkstatus/url"/>
                <br/>            
                <strong>Depth: </strong>
                <xsl:value-of select="/klinkstatus/depth"/>            
                <br/>            
                <strong>Check Parent Folders: </strong>
                <xsl:value-of select="/klinkstatus/check_parent_folders"/>            
                <br/>            
                <strong>Check external links: </strong>
                <xsl:value-of select="/klinkstatus/check_external_links"/>            
                <br/>                            
                <xsl:if test="/klinkstatus/check_regular_expression[@check = 'true']">
                    <strong>Do not check links matching regular expression: </strong>
                    <xsl:value-of select="/klinkstatus/check_regular_expression"/>                    
                    <br/>            
                </xsl:if>               
                <br/>            
                
                <table border="1">
                    <thead>
                        <tr>
                            <th>URL</th>
                            <th>Status</th>
                            <th>Label</th>
                            <th>Referrers</th>
                        </tr>
                    </thead>
                    <tbody>
                        <xsl:for-each select="/klinkstatus/link_list/link">                  
                            <tr>
                                <td>         
                                    <xsl:apply-templates select="url"/> 
                                </td>            
                                <td>         
                                    <xsl:apply-templates select="status"/>
                                </td>            
                                <td>         
                                    <xsl:apply-templates select="label"/>
                                </td>            
                                <td>         
                                    <xsl:apply-templates select="referrers"/>
                                </td>            
                            </tr>         
                        </xsl:for-each>
                    </tbody>                  
                </table>                    
            </body>
        </html>
    </xsl:template>
    
    <xsl:template match="url">
        <xsl:variable name="isBroken">
            <xsl:value-of select="../status/@broken"/>
        </xsl:variable>
        <xsl:choose>
            <xsl:when test="$isBroken='true'">
                <span style="color: red;"> 
                    <xsl:value-of select="."/>
                </span> 
            </xsl:when>
            <xsl:otherwise>              
                <xsl:value-of select="."/>
            </xsl:otherwise>
        </xsl:choose>      
    </xsl:template>
    
    <xsl:template match="status">
        <xsl:value-of select="."/>
        <br/>      
    </xsl:template>
    
    <xsl:template match="label">      
        <xsl:value-of select="."/>
        <br/>      
    </xsl:template>
    
    <xsl:template match="referrers">
        <xsl:for-each select="url">
            <xsl:apply-templates select="."/>
        </xsl:for-each>   
    </xsl:template>
    
    
    <xsl:template match="/klinkstatus/link_list/link/referrers/url">
        <xsl:value-of select="."/>
        <br/>
    </xsl:template>
    
</xsl:stylesheet>