-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBeliefHTMLConverter.slt
81 lines (78 loc) · 3.92 KB
/
BeliefHTMLConverter.slt
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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/BeliefAnalysis">
<html>
<head>
<style>
.belief {
margin-bottom: 20px;
}
.table-container {
display: flex;
flex-wrap: wrap;
}
.belief-table {
flex: 1;
min-width: 300px;
border-collapse: collapse;
margin-right: 10px;
margin-bottom: 10px;
}
.belief-table th, .belief-table td {
border: 1px solid black;
padding: 5px;
}
</style>
</head>
<body>
<xsl:for-each select="Beliefs/Belief">
<div class="belief">
<h3><xsl:value-of select="Statement"/></h3>
<div class="table-container">
<!-- Reasons to Agree Table -->
<xsl:if test="/BeliefAnalysis/Arguments/Argument[ConclusionID=current()/BeliefID and ArgumentType='Supporting']">
<table class="belief-table">
<caption>Reasons to Agree</caption>
<tr>
<th>Statement</th>
<th>Score</th>
<th>Linkage</th>
</tr>
<xsl:for-each select="/BeliefAnalysis/Arguments/Argument[ConclusionID=current()/BeliefID and ArgumentType='Supporting']">
<xsl:variable name="argID" select="ArgumentID"/>
<xsl:variable name="linkedBelief" select="/BeliefAnalysis/Beliefs/Belief[BeliefID = $argID]"/>
<tr>
<td><xsl:value-of select="$linkedBelief/Statement"/></td>
<td><xsl:value-of select="$linkedBelief/Score"/></td>
<td><xsl:value-of select="LinkageScore"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:if>
<!-- Reasons to Disagree Table -->
<xsl:if test="/BeliefAnalysis/Arguments/Argument[ConclusionID=current()/BeliefID and ArgumentType='Weakening']">
<table class="belief-table">
<caption>Reasons to Disagree</caption>
<tr>
<th>Statement</th>
<th>Score</th>
<th>Linkage</th>
</tr>
<xsl:for-each select="/BeliefAnalysis/Arguments/Argument[ConclusionID=current()/BeliefID and ArgumentType='Weakening']">
<xsl:variable name="argID" select="ArgumentID"/>
<xsl:variable name="linkedBelief" select="/BeliefAnalysis/Beliefs/Belief[BeliefID = $argID]"/>
<tr>
<td><xsl:value-of select="$linkedBelief/Statement"/></td>
<td><xsl:value-of select="$linkedBelief/Score"/></td>
<td><xsl:value-of select="LinkageScore"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:if>
</div>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>