-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodlisttransformer.xhtml
57 lines (53 loc) · 1.85 KB
/
modlisttransformer.xhtml
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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE HTML SYSTEM "about:legacy-compat">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8"/>
<title>Mod List Transformer</title>
<meta name="description" content="Transform ATL version.xml into a modlist.md"/>
<meta name="author" content="Léa Gris"/>
<meta name="keywords" content="xslt, xml, markdown, conversion tool"/>
</head>
<body onload="displayResult()">
<pre id="modlist"></pre>
<script type="application/javascript"><![CDATA[
function loadXMLDoc(filename)
{
if (window.ActiveXObject)
{
xhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
else
{
xhttp = new XMLHttpRequest();
}
xhttp.open("GET", filename, false);
try {xhttp.responseType = "msxml-document"} catch(err) {} // Helping IE11
xhttp.send("");
return xhttp.responseXML;
}
function displayResult()
{
// https://github.com/ATLauncher/Website-Issues/issues/101#issuecomment-294363498
// Thank to @Cherry for the implementation
xml = loadXMLDoc("https://download.nodecdn.net/containers/atl/packs/BeyondRealityFarscapes/versions/devBuild1.11/Configs.xml");
//xml = loadXMLDoc("https://rawgit.com/Beyond-Reality/Beyond-Realty-Farscapes/master/version.xml");
xsl = loadXMLDoc("https://rawgit.com/Beyond-Reality/Beyond-Realty-Farscapes/master/modlist.xsl");
// code for IE
if (window.ActiveXObject || xhttp.responseType == "msxml-document")
{
ex = xml.transformNode(xsl);
document.getElementById("example").innerHTML = ex;
}
// code for Chrome, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml, document);
document.getElementById("modlist").appendChild(resultDocument);
}
}
]]></script>
</body>
</html>