Skip to content

Implement xsl:output indent="yes" (resolves #219). - #220

Merged
leonelsanchesdasilva merged 2 commits into
mainfrom
fix-219-xsl-output-indent
Aug 14, 2026
Merged

Implement xsl:output indent="yes" (resolves #219).#220
leonelsanchesdasilva merged 2 commits into
mainfrom
fix-219-xsl-output-indent

Conversation

@leonelsanchesdasilva

Copy link
Copy Markdown
Collaborator

xmlTransformedText ignored the indent attribute entirely, so <xsl:output indent="yes"/> had no effect on the result tree serialization.

Elements are now pretty-printed (2-space indent) when indent="yes" and all of an element's children are elements, comments, or processing instructions (i.e. no significant text), so mixed content is left untouched to avoid corrupting text values. xsl:result-document accepts its own indent attribute, falling back to xsl:output when unspecified.

Several existing tests declared indent="yes" without any assertion depending on it (a leftover from indent being a no-op); their expected strings are updated to the now-correct indented output.

Bumps src/xpath/lib submodule to DesignLiquido/xpath@39bb40d.

`xmlTransformedText` ignored the indent attribute entirely, so `<xsl:output indent="yes"/>` had no effect on the result tree serialization.

Elements are now pretty-printed (2-space indent) when `indent="yes"` and all of an element's children are elements, comments, or processing instructions (i.e. no significant text), so mixed content is left untouched to avoid corrupting text values. `xsl:result-document` accepts its own indent attribute, falling back to `xsl:output` when unspecified.

Several existing tests declared `indent="yes"` without any assertion depending on it (a leftover from indent being a no-op); their expected strings are updated to the now-correct indented output.

Bumps `src/xpath/lib` submodule to DesignLiquido/xpath@39bb40d.
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
79.39% (+0.08% 🔼)
3448/4343
🟡 Branches
69.2% (+0.12% 🔼)
2036/2942
🟡 Functions
72.81% (+0.25% 🔼)
407/559
🟡 Lines
79.54% (+0.08% 🔼)
3301/4150

Test suite run success

681 tests passing in 67 suites.

Report generated by 🧪jest coverage report action from 5fa47a4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements support for xsl:output indent="yes" (and per-xsl:result-document overrides) by threading an indent flag into XML/HTML serialization and updating expectations across affected tests.

Changes:

  • Add indent to serialization options and plumb it from xsl:output and xsl:result-document.
  • Implement pretty-printing in xmlTransformedText with a 2-space indentation rule that avoids mixed-content corruption.
  • Update and add tests to assert the new indentation behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/xslt/xslt.test.tsx Updates expected serialized output strings to match new pretty-print behavior.
tests/xslt/output-indent.test.ts Adds focused test coverage for xsl:output / xsl:result-document indentation behavior.
tests/xslt/include.test.tsx Updates expected included-stylesheet output to include indentation/newlines.
tests/xslt/import.test.tsx Updates expected imported-stylesheet output to include indentation/newlines.
tests/xslt/choose.test.tsx Updates expected outputs to reflect indentation when indent="yes" is present.
tests/lmht/lmht.test.tsx Updates LMHT-related expectations to match indented serialization.
tests/lmht/html-to-lmht.test.tsx Updates HTML→LMHT transformation expectations to match indented serialization.
src/xslt/xslt.ts Parses/stores indent from xsl:output and applies per-xsl:result-document override.
src/dom/xml-output-options.ts Extends XmlOutputOptions with optional indent and documents behavior.
src/dom/xml-functions.ts Implements indentation logic during DOM serialization.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/dom/xml-functions.ts
Comment thread src/dom/xml-functions.ts
@leonelsanchesdasilva
leonelsanchesdasilva merged commit a7c2bf5 into main Aug 14, 2026
3 checks passed
@leonelsanchesdasilva
leonelsanchesdasilva deleted the fix-219-xsl-output-indent branch August 14, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants