Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XSLT Transform & Validate

A simple Python application with both GUI and CLI modes to:

  1. Apply an XSLT transformation to an XML invoice (Rechnung).
  2. Validate the transformed XML using the KoSIT Validator Java application.

Prerequisites

  • Python 3.8+
  • Java 8+ (to run the KoSIT Validator JAR)
  • pip (Python package installer) or pipx

Optional for GUI:

  • A system with GUI support (on Linux, ensure an X server is available).

Setup & Virtual Environment

It's recommended to use a Python virtual environment to avoid system permissions issues:

  1. Create a virtual environment in the project root:

    python3 -m venv venv
  2. Activate the environment:

    • On Linux/macOS:

      source venv/bin/activate
    • On Windows (PowerShell):

      .\venv\Scripts\Activate.ps1
  3. Upgrade pip (inside the venv):

    pip install --upgrade pip
  4. Install Python dependencies:

    pip install -r requirements.txt

Validator Setup

  1. Create a directory to hold the KoSIT Validator:

    mkdir -p ~/validator && cd ~/validator
  2. Download & unzip the distribution:

    curl -L \
      "https://github.com/itplr-kosit/validator/releases/download/v1.5.0/validator-1.5.0-distribution.zip" \
      --output validator.zip
    unzip validator.zip
  3. Copy your scenarios.xml from this repo into ~/validator.


Usage

GUI Mode

With the virtual environment activated, simply run:

python app.py
  1. In the window, Browse to select:

    • XSLT file (*.xsl or *.xslt)
    • Input XML invoice file (*.xml)
    • validationtool-1.5.0-standalone.jar
    • scenarios.xml
    • Validator repository directory (resources/ folder)
    • (Optional) Output directory (defaults to reports/)
  2. Click Run.

  3. A dialog shows success or validation errors.

  4. Reports (HTML + XML) are saved in the output directory.

CLI Mode

Still with the venv activated, run:

python app.py \
  path/to/transform.xsl \
  path/to/input.xml \
  --validator-jar ~/validator/validationtool-1.5.0-standalone.jar \
  --scenarios ~/validator/scenarios.xml \
  --repository ~/validator/resources \
  --output-dir ./reports

Example:

python app.py \
  default_fusion_UNCEFACT_CII.xsl \
  502715.xml \
  --validator-jar ~/validator/validationtool-1.5.0-standalone.jar \
  --scenarios ~/validator/scenarios.xml \
  --repository ~/validator/resources \
  --output-dir ./reports

Project Structure

├── app.py               # Main application (GUI + CLI)
├── requirements.txt     # Python dependencies
├── README.md            # This file
├── venv/                # Virtual environment (ignored by git)
└── ...

For issues or contributions, please open a GitHub issue or pull request.

About

This application is very simple.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages