[x3d-public] Trying to use X3dToJson.xslt in web page to produce JSON.
John Carlson
yottzumm at gmail.com
Fri Nov 27 23:35:56 PST 2015
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/67dcc407/attachment.html>
More information about the x3d-public
mailing list