PureXML/Sources/XSLT/XSLTUnitCollector.swift
Mihaela Mihaljevic ef4e7afa7a feat(xslt): post-order import precedence, scoped apply-imports, relative hrefs
Import precedences are assigned in post-order over the import tree, so
sibling imports are distinct and every unit sits above its own
imports; apply-imports searches only the current template's
stylesheet's own import subtree per 5.6, reverting to the built-in
rule when that unit imports nothing; an included stylesheet's
declarations join the including unit at its precedence while its
imports join the import list; and include/import hrefs resolve against
the including stylesheet's URI. Included documents' roots stay
retained until their declarations are parsed (tree parents are weak,
so the in-scope xmlns chain could vanish mid-compile). Xalan baseline
159 -> 144 (reluri 11 -> 3, impincl 9 -> 2).
2026-06-10 16:27:06 +02:00

12 lines
499 B
Swift

/// The state accumulated while flattening one unit: its queued
/// declarations, the import-precedence counter, and the included
/// documents' roots. Tree nodes hold their parents weakly, so the
/// roots must stay retained until the declarations are parsed or the
/// ancestor chain (xmlns declarations, exclusions, aliases in scope)
/// silently disappears.
struct XSLTUnitCollector {
var counter: Int
var declarations: [(XSLTTree, String)] = []
var retainedRoots: [XSLTTree] = []
}