From 2a403004793873ea9b2362f08d587475eea65e73 Mon Sep 17 00:00:00 2001 From: Mihaela Mihaljevic Date: Tue, 9 Jun 2026 02:53:50 +0200 Subject: [PATCH] feat(xslt): emit xsl:output doctype-public/doctype-system When doctype-system (optionally with doctype-public) is set on xsl:output, a for the result's root element is emitted before the serialized output: PUBLIC when both identifiers are given, SYSTEM otherwise. Works for the XML and HTML output methods. Part of #82. --- CHANGELOG.md | 1 + Sources/XSLT/XSLTModel.swift | 10 +++++++ Sources/XSLT/XSLTParser.swift | 6 ++-- Sources/XSLT/XSLTTransform.swift | 22 ++++++++++++-- Tests/XSLTDoctypeOutputTests.swift | 46 ++++++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 Tests/XSLTDoctypeOutputTests.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f3e225..89b8832 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- XSLT `xsl:output` `doctype-public`/`doctype-system` (#82). When either is set, a `` for the result's root element (PUBLIC when both are given, SYSTEM otherwise) is emitted before the serialized output, for XML and HTML methods. - XSLT `key()` over a node-set second argument (#82). `key(name, node-set)` (including `key('k', .)`) now unions the matches for every node's string value and de-duplicates, rather than using only the first node's string value. - XSLT `method="html"` output (#82). An `xsl:output method="html"` result is now serialized by the HTML rules (void elements like `
` emitted without a self-closing slash, raw-text elements like `