Skip to content

Commit 48307fc

Browse files
Package updates; Unit test for issue #126.
1 parent cb59ea3 commit 48307fc

File tree

3 files changed

+46
-5
lines changed

3 files changed

+46
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"rollup-plugin-terser": "^4.0.3",
6969
"ts-jest": "^29.2.5",
7070
"ts-node": "^10.9.2",
71-
"typescript": "^5.5.4"
71+
"typescript": "^5.9.2"
7272
},
7373
"dependencies": {
7474
"he": "^1.2.0"

tests/xslt/value-of.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import assert from 'assert';
2+
3+
import { XmlParser } from "../../src/dom";
4+
import { Xslt } from "../../src/xslt";
5+
6+
describe('xsl:value-of', () => {
7+
it('Issue 126', async () => {
8+
const xmlString = `<?xml version="1.0" encoding="UTF-8"?>
9+
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
10+
<title>Fergie</title>
11+
</feed>`
12+
13+
const xsltString = `<xsl:stylesheet
14+
version="1.0"
15+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16+
xmlns:atom="http://www.w3.org/2005/Atom"
17+
exclude-result-prefixes="atom"
18+
>
19+
20+
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
21+
22+
<xsl:template match="/atom:feed">
23+
<h1><xsl:value-of select="atom:title"/>'s Web Feed Preview</h1>
24+
</xsl:template>
25+
26+
</xsl:stylesheet>
27+
`
28+
29+
const xsltClass = new Xslt();
30+
const xmlParser = new XmlParser();
31+
const xml = xmlParser.xmlParse(xmlString);
32+
const xslt = xmlParser.xmlParse(xsltString);
33+
34+
const outXmlString = await xsltClass.xsltProcess(xml, xslt);
35+
// ?
36+
// outXmlString is "<h1>'s Web Feed Preview</h1>" and not "<h1>Fergie's Web Feed Preview</h1>" as expected)
37+
// ?
38+
39+
assert.equal(outXmlString, `<h1>Fergie's Web Feed Preview</h1>`);
40+
});
41+
});

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6678,10 +6678,10 @@ typedarray-to-buffer@^3.1.5:
66786678
dependencies:
66796679
is-typedarray "^1.0.0"
66806680

6681-
typescript@^5.5.4:
6682-
version "5.6.3"
6683-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b"
6684-
integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==
6681+
typescript@^5.9.2:
6682+
version "5.9.2"
6683+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.2.tgz#d93450cddec5154a2d5cabe3b8102b83316fb2a6"
6684+
integrity sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==
66856685

66866686
undici-types@~6.19.8:
66876687
version "6.19.8"

0 commit comments

Comments
 (0)