[x3d-public] Trying to use X3dToJson.xslt in web page to produce JSON.

John Carlson yottzumm at gmail.com
Sat Nov 28 00:31:20 PST 2015


I tried removing all line breaks outputted from the stylesheet.  Same result.  and xmlsh works.  This is getting strange.

John
> On Nov 28, 2015, at 1:35 AM, John Carlson <yottzumm at gmail.com> wrote:
> 
> Don, I’m trying to use X3dToJson.xslt in a web page to produce JSON from X3D XML.
> 
> Here’s what I get:
> 
> 
> { "X3D": {
> 
> 
> Here’s my function:
> 
> 	function convertXMLToJSON() {
> 		$.get("X3dToJson.xslt", function(xsl) {
> 			var content = $('textarea#xml').val();
> 			var xml = $.parseXML(content);
> 			// code for IE
> 			if (window.ActiveXObject) {
> 				json = xml.transformNode(xsl);
> 			}
> 			// code for Chrome, Firefox, Opera, etc.
> 			else if (document.implementation && document.implementation.createDocument) {
> 				xsltProcessor = new XSLTProcessor();
> 				xsltProcessor.importStylesheet(xsl);
> 				json = xsltProcessor.transformToDocument(xml);
> 			}
> 			console.log('JSON', json);
> 			$('textarea#json').val(getXmlString(json));
> 		}, "xml");
> 	}
> 
> The stylesheet and input works fine in xmlsh.  Would it be possible to change a stylesheet parameter to not emit newlines or line breaks—or possibly remove all line breaks in output at the end—or my problem might be solved a different way?  I’m going to work on a simpler example.
> 
> John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20151128/8ed2a067/attachment.html>


More information about the x3d-public mailing list