X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/0f85687b659a680eaec03dedc7b0060731983463..6f02e7672f06818752ac466496e1b1596f75e4f9:/platforma/static/js/xslt.js 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'); }); };