-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexamples_status.xsl
114 lines (102 loc) · 3.59 KB
/
examples_status.xsl
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?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="/">
<html>
<head>
<script>
function loadXMLDoc(fname)
{
var xmlDoc;
xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.async=false;
xmlDoc.load(fname);
return(xmlDoc);
}
function displayResult(filepath_xml,filepath_xsl)
{
var fpath_xml = filepath_xml;
var fpath_xsl = filepath_xsl;
xml=loadXMLDoc(fpath_xml);
xsl=loadXMLDoc(fpath_xsl);
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
var ref = window.open("");
ref.document.write('<html>' + '<head>' + '</head>' + '<body>' + '<div id="test" />' + '</body>' + '</html>');
ref.document.getElementById("test").appendChild(resultDocument);
ref.document.close();
}
</script>
</head>
<body>
<div id="test" />
<table border="2">
<tr bgcolor="#0000CD">
<th>n</th>
<th>status</th>
<th>name</th>
<th>modification time</th>
<th>iterations</th>
</tr>
<xsl:for-each select="//dir">
<tr>
<xsl:variable name="PATH" select="//@calchome"></xsl:variable>
<xsl:variable name="DIR"><xsl:value-of select="../@path"/></xsl:variable>
<xsl:variable name="FILEPATH"><xsl:value-of select="../@path"/>/info.xml</xsl:variable>
<xsl:variable name="FILEPATH_in"><xsl:value-of select="../@path"/>/input.xml</xsl:variable>
<xsl:variable name="SHOW_INFO">displayResult("file://<xsl:value-of select="$FILEPATH"/>","file://<xsl:value-of select="$FILEPATH"/>/info.xsl")</xsl:variable>
<xsl:variable name="SHOW_INPUT">displayResult("file://<xsl:value-of select="$FILEPATH_in"/>","file://<xsl:value-of select="$FILEPATH"/>/inputtohtml.xsl")</xsl:variable>
<!-- <xsl:value-of select="$FILEPATH"></xsl:value-of> -->
<!-- <xsl:value-of select="document($FILEPATH,info/groundstate)"></xsl:value-of> -->
<th>
<xsl:value-of select="position()"/>
</th>
<xsl:choose>
<xsl:when test="document($FILEPATH,info/groundstate[@status='finished'])">
<th bgcolor="#228B22">
<Status>: calculation finished </Status>
</th>
</xsl:when>
<xsl:otherwise>
<th bgcolor = "#FF0000">
<Status>: failed </Status>
</th>
</xsl:otherwise>
</xsl:choose>
<th>
<Name> <xsl:value-of select="$DIR"></xsl:value-of> </Name>
</th>
<th>
<Time> <xsl:value-of select="../modify-time"></xsl:value-of> </Time>
</th>
<th>
<It_nr><xsl:value-of select="count(document($FILEPATH)/info/groundstate/scl/iter)"/></It_nr>
</th>
<th>
<xsl:element name="a">
<xsl:attribute name="href">#</xsl:attribute>
<xsl:attribute name="onclick"><xsl:value-of select="$SHOW_INFO"/></xsl:attribute>
<xsl:text>info</xsl:text>
</xsl:element>
</th>
<th>
<xsl:element name="a">
<xsl:attribute name="href">#</xsl:attribute>
<xsl:attribute name="onclick"><xsl:value-of select="$SHOW_INPUT"/></xsl:attribute>
<xsl:text>input</xsl:text>
</xsl:element>
</th>
</tr>
</xsl:for-each>
</table>
<block>
<th><xsl:value-of select="count(//file[@name='info.xml'])"/></th>
<th> of </th>
<th><xsl:value-of select="count(//file[@name='input.xml'])"/></th>
<th> input files </th>
</block>
</body>
</html>
</xsl:template>
</xsl:stylesheet>