https://github.com/objectionary/xax
Java library for testing XSL stylesheets with XML samples and XPath assertions
https://github.com/objectionary/xax
hamcrest-matchers java jcabi xml xsl xslt
Last synced: about 1 year ago
JSON representation
Java library for testing XSL stylesheets with XML samples and XPath assertions
- Host: GitHub
- URL: https://github.com/objectionary/xax
- Owner: objectionary
- License: mit
- Created: 2022-12-05T14:20:43.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-04-29T05:32:06.000Z (about 1 year ago)
- Last Synced: 2025-04-29T06:27:20.905Z (about 1 year ago)
- Topics: hamcrest-matchers, java, jcabi, xml, xsl, xslt
- Language: Java
- Homepage:
- Size: 247 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# JUnit Matcher for XSL Transformations
[](https://www.elegantobjects.org)
[](https://www.rultor.com/p/objectionary/xax)
[](https://www.jetbrains.com/idea/)
[](https://github.com/objectionary/xax/actions/workflows/mvn.yml)
[](https://www.0pdd.com/p?name=objectionary/xax)
[](https://maven-badges.herokuapp.com/maven-central/org.eolang/xax)
[](https://www.javadoc.io/doc/org.eolang/xax)
[](https://codecov.io/gh/objectionary/xax)
[](https://hitsofcode.com/view/github/objectionary/xax)
[](https://github.com/objectionary/xax/blob/master/LICENSE.txt)
This simple library can help you test your XSL stylesheets against different XML
document and assert the validity of transformations using XPath expressions.
You add this to your `pom.xml`:
```xml
org.eolang
xax
0.6.2
```
Then, create this XSL file in `src/main/resources/simple.xsl`:
```xml
bye
```
Then, create this YAML file in `src/test/resources/simple.yaml`:
```yaml
sheets:
- simple.xsl
document:
hello
asserts:
- /doc/foo[.='bye']
```
Finally, make a unit test (using
[JUnit5](https://github.com/junit-team/junit5),
[Hamcrest](https://github.com/hamcrest/JavaHamcrest),
and `@ClasspathSource` from [Jucs](https://github.com/objectionary/jucs)):
```java
import org.eolang.jucs.ClasspathSource;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.params.ParameterizedTest;
final class MyTest {
@ParameterizedTest
@ClasspathSource(value = "", glob = "**.yaml")
void itWorks(String yaml) {
MatcherAssert.assertThat(
new XaxStory(yaml),
Matchers.is(true)
);
}
}
```
Should work.
## How to Contribute
Fork repository, make changes, send us a
[pull request](https://www.yegor256.com/2014/04/15/github-guidelines.html).
We will review your changes and apply them to the `master` branch shortly,
provided they don't violate our quality standards. To avoid frustration,
before sending us your pull request please run full Maven build:
```bash
mvn clean install -Pqulice
```
You will need Maven 3.3+ and Java 8+.