v1.1.3
Fixed
-
Empty
xsl:param/xsl:variablewas true in boolean tests (#11) - a variable-binding element with neitherselectnor content became an empty result tree fragment, which converts totrue. XSLT 1.0 section 11.2 gives it the empty string, so<xsl:param name="p"/>followed by<xsl:if test="$p">is now false. This applies to global and template params, variables andxsl:with-param; a variable whose content produces no nodes is still a (true) result tree fragment, andsetParameter()still overrides the default. -
Empty XHTML elements were written as
<script/>or<div/>, which breaks when XHTML is parsed as HTML. Empty elements in the XHTML namespace now follow the XHTML compatibility guidelines like libxml2 (Chrome) and Firefox: void elements as<br />, all others with an explicit end tag (<script src="a.js"></script>). Elements in other namespaces keep<x/>. -
Output
encodingwas ignored: characters the declared encoding cannot represent are now written as character references (€, or HTML entity names such as€withmethod="html"; CDATA sections are split around them). The CLI writes the file and stdout as bytes in the declared encoding (UTF-16 with a BOM; unknown multi-byte encodings fall back to UTF-8 with a warning). Previously anISO-8859-1declaration was followed by UTF-8 bytes. -
name(),local-name(),namespace-uri()returned#document,#textand#commentfor unnamed nodes; they return""(XPath 4.1), and a processing instruction's name is its target. -
id()with a node-set argument used only the first node and could return duplicates; every node's value is split and the result is a set in document order. -
/andkey()insideexsl:node-set()trees resolved against the source document instead of the fragment containing the context node. -
lang()now works from text and attribute nodes and honours onlyxml:lang, not a plainlangattribute. -
cdata-section-elementscompares expanded names (a prefix bound to the same namespace matches; a bare name no longer matches the same local name in any namespace). -
HTML output method now follows libxslt/Chrome: a
Content-Typemeta is added tohead,&{and<stay unescaped in attribute values, and non-ASCII characters in URI attributes (href,src, ...) are %-escaped as UTF-8. -
Node-set functions (
count(),sum(),name(),local-name(),namespace-uri()) given a number, string or boolean now raise a type error instead of returning a made-up value. -
CLI:
--methodaccepts onlyxml,html,xhtmlortext; the root directory/(or a drive root) works as base directory. -
Computed names are validated (XML 1.0 5th ed. QNames):
xsl:element/xsl:attributenames such as1a,x{ora:b:c, undeclared prefixes andxmlnsattribute names are reported withconsole.warnand skipped, as libxslt does, instead of producing malformed output.xsl:element name="p:e" namespace=""creates<e/>in no namespace. -
xsl:fallbackis instantiated for unknown XSLT instructions (XSLT 15), and forwards-compatible mode (versionother than 1.0) ignores unknown top-level elements. -
xsl:numberdefault count compares expanded names and processing-instruction targets. -
xsl:output cdata-section-elementsnames are expanded with the namespaces in scope onxsl:output, including the default namespace for unprefixed names (XSLT 16.1); severalxsl:outputlists are united and undeclared prefixes are reported. -
isNativeXSLTSupported()no longer reports this polyfill as native afterinstallGlobal(). -
Loaders with non-jsdom DOMs (e.g. xmldom): XML strings returned by loaders are parsed with the new
domParserengine option, the globalDOMParseror the stylesheet's window, and parse errors are detected withoutquerySelector. -
Warnings for duplicate variable bindings (XSLT 11.4/11.5) and undeclared
exclude-result-prefixes/extension-element-prefixes; behaviour is unchanged (the later binding wins). -
The broken
npm run test:browserscript (it pointed to a file that does not exist) was removed;npm testnow expandssrc/**/*.test.jsitself, so test files in nested directories are no longer skipped.
Performance
-
axis::x[n]steps (the commonfollowing-sibling::x[1]/preceding-sibling::x[1]idiom) stop walking the axis after the n-th match: 8,000 siblings in a loop dropped from 4.7 s to 0.09 s. -
xsl:numberis linear per transformation: 8,000 nodes withlevel="any" count="i[@k='1']"dropped from 105 s to 0.09 s,level="single"from 5.5 s to 0.1 s. -
key()/id()patterns cache their anchor nodes per document.
Changed
-
count(5),sum('x')and similar calls now throw a type error;name(/)returns"";lang()ignores a plainlangattribute; HTML output gains aContent-Typemeta; the CLI'srunTransformation()helper returns{ output, encoding }. -
Invalid patterns in
xsl:template match,xsl:key matchandxsl:number count/fromnow makeimportStylesheet()throw an error naming the pattern (XSLT 5.2), as Chrome's native processor rejects such stylesheets; previously the template silently never matched. A failed import leaves the processor's previous stylesheet in place. -
engine.outputSettings.cdataSectionElementsholds{ namespaceUri, localName }objects instead of strings.
Added
XsltEngineoptiondomParser;XsltEngine.setStylesheetLoader()/setDocumentLoader()return the engine for chaining;XPathLimitsexport.- Complete TypeScript declarations in
scripts/xslt-processor.d.ts(DocumentLoader,XSLTProcessor.setDocumentLoader,XPathEvaluatoroptions,XPathContexthostContext, ...); a test fails when a runtime export is missing from the declarations.
Documentation
- README: corrected the Custom Security Limits example (
parseXPathinstead of the non-exportedparse) and the Node.js loader example (jsdom with a globalDOMParser; the xmldom version failed). - README: new table of contents and "Module exports", "TypeScript" and "Known Deviations" sections.
- README: conformance tables corrected (
namespace::axis not supported,xsl:fallbackand extensions partial,xsl:numberignoreslang/letter-value, the DOM is consumed rather than implemented); invented per-spec test counts replaced by real figures. - README: browser minimums corrected for the ES2022 bundle (Chrome/Edge 93, Opera 79, Samsung Internet 17); the
XsltProcessorLibCDN global and auto-install behaviour documented; development setup, Docker commands and publishing notes fixed; style-guide success and warning colours now meet WCAG 2.2 AA contrast. - SECURITY.md and CONTRIBUTORS.md rewritten for this project (they described a different project); security reports go through GitHub private vulnerability reporting.