X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/0f85687b659a680eaec03dedc7b0060731983463..b23f2eb2dba1c6e2c49f45362197b51eee60ac7c:/platforma/static/js/xslt.js?ds=inline diff --git a/platforma/static/js/xslt.js b/platforma/static/js/xslt.js index f6ddb878..71a68598 100644 --- a/platforma/static/js/xslt.js +++ b/platforma/static/js/xslt.js @@ -181,16 +181,24 @@ function html2xml(options) { var serializer = new XMLSerializer(); var doc = parser.parseFromString(xml, 'text/xml'); var error = $('parsererror', doc.documentElement); - + if (error.length == 0) { - doc = html2xmlStylesheet.transformToDocument(doc, document); + doc = html2xmlStylesheet.transformToDocument(doc); error = $('parsererror', doc.documentElement); } if (error.length > 0 && options.error) { options.error(error.text()); } else { - options.success(serialize(doc.documentElement).join('')); + if (options.inner) { + var result = []; + for (var i = 0; i < doc.documentElement.childNodes.length; i++) { + result.push(serialize(doc.documentElement.childNodes[i]).join('')); + }; + options.success(result.join('')); + } else { + options.success(serialize(doc.documentElement).join('')); + } } }, function() { options.error && options.error('Nie udało się załadować XSLT'); }); };