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
- Host: GitHub
- URL: https://github.com/pldg/xth
- Owner: pldg
- License: mit
- Created: 2019-01-18T08:07:59.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2022-09-07T18:12:31.000Z (almost 4 years ago)
- Last Synced: 2025-09-02T01:38:24.686Z (10 months ago)
- Topics: browser, client-side, html, npm, npm-package, stylesheet, xhtml, xml, xml-parsing, xslt, xslt-stylesheet
- Language: JavaScript
- Homepage: https://pldg.github.io/xth/
- Size: 45.9 KB
- Stars: 3
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# XTH


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.