-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.html
50 lines (38 loc) · 2.16 KB
/
index.html
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
<!DOCTYPE HTML>
<html>
<head>
<meta content="text/html" charset="UTF-8">
<title>JS XML/XSLT Library</title>
<link rel="stylesheet" type="text/css" href="css.css">
<script type="text/javascript" language="JavaScript" src="stand.js"></script>
<!-- <script type="text/javascript" language="JavaScript" src="jquery/jquery.js"></script> -->
<!-- <script type="text/javascript" language="JavaScript" src="prototype.js"></script> -->
<script type="text/javascript" language="JavaScript" src="yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" language="JavaScript" src="yui/build/connection/connection-min.js"></script>
<!--
<script type="text/javascript" language="JavaScript" src="extjs/ext-base.js"></script>
<script type="text/javascript" language="JavaScript" src="extjs/ext-all-debug.js"></script>
-->
<script type="text/javascript" language="JavaScript" src="jsxml.js"></script>
<script type="text/javascript" language="JavaScript">
function run(){
var xml = '<?xml version="1.0" encoding="UTF-8"?><root/>',
xsl = '<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output encoding="UTF-8" indent="yes" method="html"/><xsl:template match="/root"><div/></xsl:template></xsl:stylesheet>';
var dom = JSXML.fromString('<?xml version="1.0" encoding="UTF-8"?><root/>'),
child = dom.createElement('child');
child.setAttribute('foo' ,'bar')
dom.documentElement.appendChild(child)
alert("stringify\r\n"+ JSXML.stringify(dom))
JSXML.load('xml.xml' ,function(dom){
alert("load\r\n"+ JSXML.stringify(dom))
});
var resultString = JSXML.transReady(xml, xsl);
alert("transReady\r\n" + resultString)
JSXML.trans('xml.xml', 'xsl.xsl', function(result){
alert("trans\r\n"+ result)
})
}
</script>
</head>
<body onload="javascript:run()"></body>
</html>