commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r954068 - /commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransform.html
Date Sat, 12 Jun 2010 19:36:12 GMT
Author: jbeard
Date: Sat Jun 12 19:36:11 2010
New Revision: 954068

URL: http://svn.apache.org/viewvc?rev=954068&view=rev
Log:
Added test for using xsl transforms in the browser. Doesn't quit work.

Added:
    commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransform.html   (with props)

Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransform.html
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransform.html?rev=954068&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransform.html (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransform.html Sat Jun 12 19:36:11
2010
@@ -0,0 +1,37 @@
+<html>
+<head>
+	<script>
+		function doXHR(url, callback) {
+			var xhr = new XMLHttpRequest();
+			xhr.open('GET', url, true);
+			xhr.onreadystatechange = function (evt) {
+				//Do not explicitly handle errors, those should be
+				//visible via console output in the browser.
+				if (xhr.readyState === 4) {
+					callback(xhr.responseXML);
+				}
+			};
+			xhr.send(null);
+		};
+
+		//load xml
+		doXHR( "http://localhost:8081/test/xslt/StatePatternStatechartGenerator.xsl", function(statePatternStatechartGeneratorXSL){
+			doXHR( "http://localhost:8081/test/kitchen_sink/KitchenSink.xml", function(kitchenSinkXML){
+				//transform to js
+				var processor = new XSLTProcessor();  
+				processor.importStylesheet(statePatternStatechartGeneratorXSL); 
+
+				var newDocument = processor.transformToDocument(kitchenSinkXML);  
+
+				var resultText = newDocument.documentElement.firstChild.textContent;
+				console.log(resultText);
+				
+				//eval
+				eval(resultText);
+			});
+		});
+	</script>
+</head>
+<body>
+</body>
+</html>

Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransform.html
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message