Skip to content

#105 Add test for empty XSL stylesheet#486

Merged
yegor256 merged 1 commit into
jcabi:masterfrom
bibonix:fix-105-empty-xsl-stylesheet
May 8, 2026
Merged

#105 Add test for empty XSL stylesheet#486
yegor256 merged 1 commit into
jcabi:masterfrom
bibonix:fix-105-empty-xsl-stylesheet

Conversation

@bibonix

@bibonix bibonix commented May 8, 2026

Copy link
Copy Markdown
Contributor

@yegor256 this PR closes #105 by adding the missing regression test for the empty <xsl:stylesheet> case from the issue.

What was missing

XSLDocumentTest had no coverage for the empty-stylesheet input shown in the issue body:

<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='2.0'></xsl:stylesheet>

What this adds

A new test emptyStylesheetExtractsTextContent that:

  1. Constructs an XSLDocument from the empty stylesheet from the issue.
  2. Calls applyTo(...) on <a><b>hello</b><c>world</c></a>.
  3. Asserts the output contains helloworld, which is the documented XSLT behavior: with no template rules defined, the built-in templates traverse the tree and emit text nodes verbatim, so the concatenated text content is the expected result.

This pins the documented XSLT default-rules behavior so future regressions in XSLDocument (e.g. accidentally rejecting an empty stylesheet at construction time, or breaking text extraction) will be caught.

Verification

  • mvn -B clean install -Pqulice passes locally on Java 21.
  • All 14 CI checks are green on this PR.

@yegor256 yegor256 merged commit a7f5273 into jcabi:master May 8, 2026
14 checks passed
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.

XSLDocumentTest should test for empty transform stylesheet

2 participants