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
- Host: GitHub
- URL: https://github.com/tjunussov/xhtml2html
- Owner: tjunussov
- License: apache-2.0
- Created: 2016-12-16T10:53:10.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-19T13:10:53.000Z (almost 9 years ago)
- Last Synced: 2025-04-04T01:29:01.372Z (10 months ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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