diff --git a/test/libxslt.js b/test/libxslt.js index 97b8f9b..34acadb 100644 --- a/test/libxslt.js +++ b/test/libxslt.js @@ -218,6 +218,37 @@ describe('node-libxslt', function() { }); }); + describe('implicitly omitted xml-declaration', function() { + + it('should be respected by a stylesheet with output method html', function() { + var data=''; + var stylesheetHtmlOut = libxslt.parse(fs.readFileSync('test/resources/implicit-omit-xml-declaration-html-out.xsl', 'utf8')); + var result = stylesheetHtmlOut.apply(data); + result.should.be.type('string'); + result.should.not.match(/\?xml/); + result.should.match(//); + result.should.match(/<\/strong>/); + result.should.match(/<bar\/>/); + result.should.not.match(/\'; + var stylesheetTextOut = libxslt.parse(fs.readFileSync('test/resources/implicit-omit-xml-declaration-text-out.xsl', 'utf8')); + var result = stylesheetTextOut.apply(data); + result.should.be.type('string'); + result.should.not.match(/\?xml/); + result.should.match(//); + result.should.match(//); + result.should.not.match(/\ + + diff --git a/test/resources/implicit-omit-xml-declaration-text-out.xsl b/test/resources/implicit-omit-xml-declaration-text-out.xsl new file mode 100644 index 0000000..510bddd --- /dev/null +++ b/test/resources/implicit-omit-xml-declaration-text-out.xsl @@ -0,0 +1,10 @@ + + + + ]]> + ]]> + + with text + + +