PureXML/Sources/XSLT
Mihaela Mihaljevic 8f992a8897
perf(xslt): cache xsl:number level single/multiple sibling ranks (#310)
siblingPosition ranked a numbered node among its parent's matching children by
scanning the child list up to the node, counting matches. Run for every node of
a wide list, numbering was O(n^2): the default xsl:number over 8000 list items
took ~3.5s.

The count test is the same for every candidate of one xsl:number call, so cache
per parent and count pattern the one-based rank of each matching child, built
once. Each node's rank is then an O(1) lookup. The transformer holds the cache
across the whole transform; the count test itself is already O(1) through the
match cache, so building a parent's ranks is linear in its children. The numbers
are identical (a node's rank among matching siblings is 1 + the matching
siblings before it).

The 8000-item numbering drops ~3.5s to ~0.04s (~90x), quadratic to linear. The
full suite, the W3C XSLT and Apache Xalan corpora, and the WASM build stay
green; XSLTNumberSingleTests pins single, partial-match, and multiple-level.
2026-06-26 01:13:07 +02:00
..
XSLTAVT.swift feat(xslt): implement xsl:namespace-alias, completing #81 2026-06-09 02:10:16 +02:00
XSLTCollation.swift feat(xpath,xslt,wasm): evaluation budget, tailored collation, WASI runtime proof 2026-06-11 06:26:13 +02:00
XSLTDocumentCache.swift fix(xslt): resolve string-form document() against the stylesheet element's base URI (closes mdocs12/13) (#257) 2026-06-24 02:03:32 +02:00
XSLTElements.swift perf(xslt): cache xsl:number level single/multiple sibling ranks (#310) 2026-06-26 01:13:07 +02:00
XSLTFunctions.swift fix(xslt): make key(), id(), and EXSLT set functions linear over wide fan-outs (#300) 2026-06-25 18:45:08 +02:00
XSLTGlobals.swift fix(xslt): resolve string-form document() against the stylesheet element's base URI (closes mdocs12/13) (#257) 2026-06-24 02:03:32 +02:00
XSLTLookups.swift fix(xslt): make key(), id(), and EXSLT set functions linear over wide fan-outs (#300) 2026-06-25 18:45:08 +02:00
XSLTMatchCache.swift XSLT/XPath conformance: close 68 Apache Xalan cases (#254) 2026-06-24 00:13:14 +02:00
XSLTModel.swift fix(xslt): xsl:namespace-alias keeps the literal prefix, remapping only the URI (closes namespace19/23/24/35/113) (#273) 2026-06-24 15:43:02 +02:00
XSLTNamespaceFixup.swift feat(xslt): attribute-set merging, copied namespaces, html booleans, loader entities 2026-06-10 16:11:02 +02:00
XSLTNumbering.swift perf(xslt): cache xsl:number level single/multiple sibling ranks (#310) 2026-06-26 01:13:07 +02:00
XSLTParser.swift fix(xslt): honor xml:space=preserve when stripping stylesheet whitespace (#271) 2026-06-24 10:57:47 +02:00
XSLTParserDeclarations.swift fix(xslt): xsl:namespace-alias keeps the literal prefix, remapping only the URI (closes namespace19/23/24/35/113) (#273) 2026-06-24 15:43:02 +02:00
XSLTParserEntry.swift fix(xslt): resolve string-form document() against the stylesheet element's base URI (closes mdocs12/13) (#257) 2026-06-24 02:03:32 +02:00
XSLTParserStructural.swift fix(xslt): evaluate the xsl:number format attribute as an AVT (#269) 2026-06-24 10:40:11 +02:00
XSLTRawText.swift feat(xslt): output methods in depth 2026-06-10 13:10:50 +02:00
XSLTRuntime.swift fix(xslt): resolve string-form document() against the stylesheet element's base URI (closes mdocs12/13) (#257) 2026-06-24 02:03:32 +02:00
XSLTSorting.swift fix(xslt): resolve string-form document() against the stylesheet element's base URI (closes mdocs12/13) (#257) 2026-06-24 02:03:32 +02:00
XSLTTransform.swift fix(xslt): serialize a namespaced element as XML under the html output method (16.2) (#260) 2026-06-24 02:48:50 +02:00
XSLTTransformer.swift perf(xslt): cache xsl:number level single/multiple sibling ranks (#310) 2026-06-26 01:13:07 +02:00
XSLTUnitCollector.swift fix(xslt): composition cycles terminate; id() gains a per-document index 2026-06-10 18:07:02 +02:00
XSLTWhitespace.swift fix(xslt): match strip-space/preserve-space element tests by namespace (#265) 2026-06-24 03:52:45 +02:00