diff --git a/CHANGELOG.md b/CHANGELOG.md index 505edaa..0b8b8eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Two unused private helpers in `XSLTNamespaceFixup` (`fixAttributeName` and `resolvedPrefix`). The result-tree attribute fixup they implemented was inlined into `fix(_ element:)` and evolved past them (the inlined version additionally shadows a carried prefix through `localPrefixes`, which the helpers did not), leaving both with zero callers. Removing them deletes dead, diverged duplicate logic with no behavior change; the live inlined path is unchanged. +- Three more dead file-scoped functions found by a private-scope sweep: `selectNodes` in `XSLTTransformer` (its sibling `selectXPathNodes` is the live one; a doc comment that referenced it was reworded), `processingInstructionMatches` in `EvaluatorSteps`, and `parseExternalID` in `DoctypeScanner`. All three are `private`/`fileprivate` with zero callers, so removing them is provably behavior-neutral (the compiler confirms). + ### Fixed - A complex type with simple content that restricts a base may no longer relax a base `required` attribute to `optional` (XSD 1.0 `cos-ct-derived-ok` / `derivation-ok-restriction.2`). The attribute-use restriction check ran only over `complexContent` restrictions, so a `simpleContent` restriction that relaxed a required attribute (or added a non-base attribute, or widened the attribute wildcard) was accepted; it now runs over both derivation roots. Closes XSTS `particlesZ030_d`, which libxml2 also rejects, so the fix aligns with the reference rather than exceeding it. XSTS invalid-schemas-accepted 10 -> 9 with valid-schemas-rejected held at 0 (full archive). Guarded by `SimpleContentAttrRestrictionTests`. diff --git a/Sources/Parsing/DoctypeScanner.swift b/Sources/Parsing/DoctypeScanner.swift index d2120da..67b485c 100644 --- a/Sources/Parsing/DoctypeScanner.swift +++ b/Sources/Parsing/DoctypeScanner.swift @@ -298,22 +298,6 @@ struct DTDScanner { } extension DTDScanner { - private func parseExternalID(_ reader: inout Reader) -> ExternalID? { - if reader.consume("SYSTEM") { - reader.skipSpace() - guard let systemID = scanLiteral(&reader) else { return nil } - return ExternalID(systemID: systemID) - } - if reader.consume("PUBLIC") { - reader.skipSpace() - guard let publicID = scanLiteral(&reader) else { return nil } - reader.skipSpace() - let systemID = scanLiteral(&reader) ?? "" - return ExternalID(publicID: publicID, systemID: systemID) - } - return nil - } - func scanLiteral(_ reader: inout Reader) -> String? { guard let quote = reader.peek(), quote == "\"" || quote == "'" else { return nil } reader.advance() diff --git a/Sources/XPath/EvaluatorSteps.swift b/Sources/XPath/EvaluatorSteps.swift index d583919..0004187 100644 --- a/Sources/XPath/EvaluatorSteps.swift +++ b/Sources/XPath/EvaluatorSteps.swift @@ -330,12 +330,6 @@ extension PureXML.XPath.Evaluator { } } - private static func processingInstructionMatches(_ node: Node, _ target: String?) -> Bool { - guard case let .tree(tree) = node, tree.kind == .processingInstruction else { return false } - guard let target else { return true } - return tree.name?.description == target - } - private static func isTreeKind(_ node: Node, in kinds: [PureXML.Model.TreeNodeKind]) -> Bool { guard case let .tree(tree) = node else { return false } return kinds.contains(tree.kind) diff --git a/Sources/XSLT/XSLTTransformer.swift b/Sources/XSLT/XSLTTransformer.swift index eb4600f..17a7c28 100644 --- a/Sources/XSLT/XSLTTransformer.swift +++ b/Sources/XSLT/XSLTTransformer.swift @@ -203,12 +203,8 @@ extension PureXML.XSLT { ) } - fileprivate func selectNodes(_ expression: String, _ context: XSLTContext) -> [PureXML.Model.TreeNode] { - value(expression, context)?.nodes?.compactMap(\.treeNode) ?? [] - } - - /// Like `selectNodes` but keeping attribute and namespace nodes, - /// which templates apply to as well. + /// Selects the nodes an expression yields, keeping attribute and namespace + /// nodes, which templates apply to as well. func selectXPathNodes(_ expression: String, _ context: XSLTContext) -> [PureXML.XPath.Node] { value(expression, context)?.nodes ?? [] }