-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
bugSomething isn't workingSomething isn't working
Description
This test case will show the problem. The output is now XYtest1
even though it should be Xtest1Y
. I think it is because the text nodes get siblingPosition
of -1 and the xsl:value-of
gets bigger than 0. Then, when it is rendering, it sorts the siblings by siblingPosition
.
it('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);
});
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working