Skip to content

Commit

Permalink
Adding unit test for #109.
Browse files Browse the repository at this point in the history
  • Loading branch information
leonelsanchesdasilva committed Oct 17, 2024
1 parent 1892a34 commit 3b8a216
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/xslt/apply-template.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,28 @@ describe('xsl:apply-template', () => {
assert.equal(outXmlString, expectedOutString);
// assert.ok(outXmlString);
});

it.skip('XSLT template with text on both sides', async () => {
const xmlString = `<root>
<test name="test1">This text lost</test>
</root>`;

const xsltString = `<?xml version="1.0"?>
<xsl:stylesheet version="1.0">
<xsl:template match="/">
<span>X<xsl:value-of select="test/@name" />Y</span>
</xsl:template>
</xsl:stylesheet>`;

const expectedOutString = `<span>Xtest1Y</span>`;

const xsltClass = new Xslt();
const xmlParser = new XmlParser();
const xml = xmlParser.xmlParse(xmlString);
const xslt = xmlParser.xmlParse(xsltString);

const outXmlString = await xsltClass.xsltProcess(xml, xslt);

assert.equal(outXmlString, expectedOutString);
});
});

0 comments on commit 3b8a216

Please sign in to comment.