@testable import PureXML import Testing @Suite("XSLT key() with the context node and node-set values") struct XSLTKeyNodeSetTests { private let xsl = "xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"" private func transform(_ stylesheet: String, _ source: String) throws -> String { try PureXML.XSLT.transform(stylesheet: stylesheet, source: source) } private let source = """ 123 ab """ @Test("key('k', .) uses the context node's string value") func test_contextNode() throws { let style = """ , """ // a -> 2 items, b -> 1 item. #expect(try transform(style, source) == "2,1,") } @Test("key('k', node-set) unions the matches for every node's value") func test_nodeSetValue() throws { let style = """ """ // a -> 2, b -> 1, unioned and de-duplicated -> 3. #expect(try transform(style, source) == "3") } @Test("key with a string value still works") func test_stringValue() throws { let style = """ """ #expect(try transform(style, source) == "2") } }