Coder Social home page Coder Social logo

xax's Introduction

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn PDD status Maven Central Javadoc codecov Hits-of-Code Lines of code License

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:

<dependency>
  <groupId>org.eolang</groupId>
  <artifactId>xax</artifactId>
</dependency>

Then, creat this XSL file in src/main/resources/simple.xsl:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
  <xsl:template match="foo">
    <xsl:copy>
      <xsl:text>bye</xsl:text>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="node()|@*" mode="#default">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

Then, create this YAML file in src/test/resources/simple.yaml:

sheets:
  - simple.xsl
document:
  <doc><foo>hello</foo></doc>
asserts:
  - /doc/foo[.='bye']

Finally, make a unit test (using JUnit5, Hamcrest, and @ClasspathSource from Jucs):

import org.eolang.jucs.ClasspathSource;
import org.eolang.xax.XaxStory;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.api.Test;

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. 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:

$ mvn clean install -Pqulice

You will need Maven 3.3+ and Java 8+.

xax's People

Contributors

renovate[bot] avatar rultor avatar yegor256 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xax's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/codecov.yml
  • actions/checkout v4
  • actions/setup-java v4
  • actions/cache v4
  • codecov/codecov-action v4.0.0-beta.3
  • ubuntu 22.04
.github/workflows/mvn.yml
  • actions/checkout v4
  • actions/setup-java v4
  • actions/cache v4
.github/workflows/pdd.yml
  • actions/checkout v4
  • ubuntu 22.04
.github/workflows/xcop.yml
  • actions/checkout v4
  • ubuntu 22.04
maven
pom.xml
  • com.jcabi:parent 0.67.0
  • org.yaml:snakeyaml 2.2
  • com.jcabi:jcabi-xml 0.29.0
  • com.yegor256:xsline 0.21.1
  • org.cactoos:cactoos 0.55.0
  • org.hamcrest:hamcrest 2.2
  • net.sf.saxon:Saxon-HE 12.4
  • org.eolang:jucs 0.2.0
  • com.qulice:qulice-maven-plugin 0.22.1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.