An open API service indexing awesome lists of open source software.

https://github.com/pldg/xth

Transform XML-XSLT to html in the browser
https://github.com/pldg/xth

browser client-side html npm npm-package stylesheet xhtml xml xml-parsing xslt xslt-stylesheet

Last synced: 4 months ago
JSON representation

Transform XML-XSLT to html in the browser

Awesome Lists containing this project

README

          

# XTH

![size-badge](https://img.shields.io/github/size/pldg/xth/xth.min.js.svg)
![downloads-badge](https://img.shields.io/npm/dt/xth.svg)

With *xth* (xml to html) you can load an XML file and its associated XSLT stylesheet and transform them to HTML.

No dependencies, weight only 1.3kb.

Works client-side in all major browsers including Internet Explorer 10 and newer versions.

## Install

### CDN

```html

```

### NPM

`npm install --save xth`

## Example

```js
var xml = 'path/to/xml';
var xsl = 'path/to/xsl';

xth(xml, xsl, function(html) {
console.log(html);
});
```

## Try online

Go to [pldg.github.io/xth](https://pldg.github.io/xth/) (the source code is in gh-pages branch).

## Test locally

1. Execute `python3 -m http.server`
2. Open `http://localhost:8000/test/`

## API

### `xml`

*Required*

*Type:* `String`

Path to XML file.

### `xsl`

*Required*

*Type:* `String`

Path to XSLT file.

### `callback`

*Required*

*Type:* `Function`

`callback(html)` takes the parsed HTML as argument.