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

https://github.com/tjunussov/xhtml2html

xhtml files to html file transformation library
https://github.com/tjunussov/xhtml2html

Last synced: 7 months ago
JSON representation

xhtml files to html file transformation library

Awesome Lists containing this project

README

          

## About

**xhtml2html.js** script file converts xhtml(xml) files in folder(s) to html using xsl template specfied in Porcessing Instruction stylesheet template

## Usage
Simple run application, it will evaluate template path from PI of ``
```
node xhtml2html.js index.xhtml
```
### All Parameters pass
1. Param - XML File
2. Param ( optional ) - XSL File ( if optional, it tries extract from XML file PI )
3. Param ( optional ) - Mode ( passes variable mode to Template as xsl:param )

```
node xhtml2html.js index.xhtml index.xsl html
```

### Directory Transform

Folder traverse usin `find` you can make batch file `x2h.sh`
```
find /myXhtmlFolder -type f -name "*.xhtml" -execdir node xhtml2html.js {} \;
```

## Issues

- Due to relative path support ( xsl:include, xsl:import, document(); ) in working folder, it is prefered to work in root folder
- libxslt with optioin `xsl:output mode="html"` converts UTF-8 to Unicode ASCI entities, so script converts it back
- Empty xmlns removal

## Dependencies
- [`libxslt`](https://github.com/albanm/node-libxslt)
- [`libxmljs`](https://github.com/libxmljs/libxmljs)

optional dependencies
```
js-beautify
colors
```

## ToDo
- Publish to npm
- Increase transformation speed
- Nodejs http, express friendly style
- Compare timestamp of xhtml and transform to html if changed
- Partial html output support with param mode