https://github.com/yegor256/xsline
Declarative and Immutable Java Chain of XSL Transformations
https://github.com/yegor256/xsline
java oop xml xsl xslt
Last synced: 3 months ago
JSON representation
Declarative and Immutable Java Chain of XSL Transformations
- Host: GitHub
- URL: https://github.com/yegor256/xsline
- Owner: yegor256
- License: mit
- Created: 2022-03-30T14:17:27.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-03-17T15:01:02.000Z (3 months ago)
- Last Synced: 2025-03-22T21:06:42.457Z (3 months ago)
- Topics: java, oop, xml, xsl, xslt
- Language: Java
- Homepage:
- Size: 600 KB
- Stars: 12
- Watchers: 3
- Forks: 5
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Pipeline of XSL Stylesheets
[](https://www.elegantobjects.org)
[](http://www.rultor.com/p/yegor256/xsline)
[](https://www.jetbrains.com/idea/)[](https://github.com/yegor256/xsline/actions/workflows/mvn.yml)
[](http://www.0pdd.com/p?name=yegor256/xsline)
[](https://maven-badges.herokuapp.com/maven-central/com.yegor256/xsline)
[](http://www.javadoc.io/doc/com.yegor256/xsline)
[](https://codecov.io/gh/yegor256/xsline)
[](https://hitsofcode.com/view/github/yegor256/xsline)
[](https://github.com/yegor256/xsline/blob/master/LICENSE.txt)
[](https://sonarcloud.io/summary/new_code?id=yegor256_xsline)Read this blog post too:
[Declarative and Immutable Pipeline of Transformations][blog].Also, watch [this video](https://www.youtube.com/watch?v=C6CQWzOKEJs)
from Object Thinking Meetup #7.It's a declarative and immutable chain of XSL transformations in Java,
which is more convenient than an imperative routine application
of transformations one by one. [EO compiler](https://github.com/objectionary/eo)
is an example use case: the source code compiles to XML and then has
to go through a few dozen transformations written in XSL. Each transformation
has to be logged, validated, and in general be flexibly configurable. We started
with a series of consecutive instantiations and executions of
[`XSLDocument`][XSLDocument],
but then realized the necessity to turn this workflow into something more
object-oriented. This is how this library was born.You add this to your `pom.xml`:
```xml
com.yegor256
xsline
0.23.1```
Use it like this:
```java
import com.jcabi.xml.XML;
import com.jcabi.xml.XMLDocument;
import com.jcabi.xml.XSLDocument;
import com.yegor256.xsline.Shift;
import com.yegor256.xsline.StXSL;
import com.yegor256.xsline.TrDefault;
import com.yegor256.xsline.Train;
import com.yegor256.xsline.Xsline;
import java.io.File;Train train = new TrDefault()
.with(new StXSL(new XSLDocument(new File("first.xsl"))))
.with(new StXSL(new XSLDocument(new File("second.xsl"))));
XML input = new XMLDocument("");
XML output = new Xsline(train).pass(input);
```This will transform your `input` XML document
through two XSL stylesheets.We use this library in
[EO-to-Java compiler](https://github.com/objectionary/eo).## 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+.
[blog]: https://www.yegor256.com/2022/08/10/xsline-immutable-pipeline.html
[XSLDocument]: https://www.javadoc.io/doc/com.jcabi/jcabi-xml/0.21.5/com/jcabi/xml/XSLDocument.html