@testable import PureXML
import Testing
@Suite("XSLT xsl:namespace-alias")
struct XSLTNamespaceAliasTests {
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)
}
@Test("A literal element in the aliased namespace is rewritten to the result namespace")
func test_rewrite() throws {
let style = """
"""
// The element's prefix is rewritten from the stylesheet alias to the result.
#expect(try transform(style, "") == "")
}
@Test("A non-aliased literal element is untouched")
func test_notAliased() throws {
let style = """
"""
#expect(try transform(style, "") == "")
}
@Test("namespace-alias can produce literal xsl: elements (stylesheet generation)")
func test_generateXSL() throws {
let style = """
"""
let out = try transform(style, "")
// The aliased axsl: element is emitted as a literal xsl: element, not run.
#expect(out.contains("xsl:value-of"))
#expect(!out.contains("axsl"))
}
}