# XSLT-processor
[![Build Status](https://travis-ci.com/fiduswriter/xslt-processor.svg?branch=master)](https://travis-ci.com/fiduswriter/xslt-processor)
_A JavaScript XSLT processor without native library dependencies._
## Howto
Install xslt-processor using npm::
```
npm install xslt-processor
```
Within your ES2015+ code, import the two main functions and apply them:
```js
import { xsltProcess, xmlParse } from 'xslt-processor'
// xmlString: string of xml file contents
// xsltString: string of xslt file contents
// outXmlString: output xml string.
const outXmlString = xsltProcess(
xmlParse(xmlString),
xmlParse(xsltString)
);
```
To access the Xpath-parser, import it like this:
```js
import { xpathParse } from 'xslt-processor'
```
If you write pre-2015 JS code, make adjustments as needed.
## Introduction
XSLT-processor contains an implementation of XSLT in JavaScript. Because XSLT uses
XPath, it also contains an implementation of XPath that can be used
independently of XSLT. This implementation has the advantage that it
makes XSLT uniformly available whenever the browser's native XSLTProcessor()
is not available such as in node.js or in web workers.
XSLT-processor builds on Google's [AJAXSLT](https://github.com/4031651/ajaxslt)
which was written before XSLTProcessor() became available in browsers, but the
code base has been updated to comply with ES2015+ and to make it work outside of
browsers.
This implementation of XSLT operates at the DOM level on its input
documents. It internally uses a DOM implementation to create the
output document, but usually returns the output document as text
stream. The DOM to construct the output document can be supplied by
the application, or else an internal minimal DOM implementation is
used. This DOM comes with a minimal XML parser that can be used to
generate a suitable DOM representation of the input documents if they
are present as text.
## Tests and usage examples
New tests are written in Jest an can be run by calling: `npm test`.
The files xslt.html and xpath.html in the directory test are interactive tests. They can be run directly from the file system; no HTTP server is needed.
Both interactive tests and automatic tests demonstrate the use of the library functions. There is not much more documentation so far.
## Conformance
A few features that are required by the XSLT and XPath standards were left out (but patches to add them are welcome).
See our [TODO](TODO.md) for a list of missing features that we are aware of (please add more items by means of PRs).
Issues are also marked in the source code using throw-statements.
The DOM implementation is minimal so as to support the XSLT processing, and not intended to be complete.
The implementation is all agnostic about namespaces. It just expects
XSLT elements to have tags that carry the xsl: prefix, but we
disregard all namespace declaration for them.
There are a few nonstandard XPath functions. Grep xpath.js for `ext-` to see their definitions.
## References
- XPath Specification http://www.w3.org/TR/1999/REC-xpath-19991116
- XSLT Specification http://www.w3.org/TR/1999/REC-xslt-19991116
- W3C DOM Level 3 Core Specification http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/
- ECMAScript Language Specification http://www.ecma-international.org/publications/standards/Ecma-262.htm
没有合适的资源?快使用搜索试试~ 我知道了~
xslt-processor:不带本机库依赖项JavaScript XSLT处理器 开发技术 - 其它.zip
共32个文件
js:19个
html:2个
md:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 55 浏览量
2023-08-11
15:03:05
上传
评论
收藏 64KB ZIP 举报
温馨提示
xslt-processor:不带本机库依赖项JavaScript XSLT处理器 开发技术 - 其它.zip
资源推荐
资源详情
资源评论
收起资源包目录
xslt-processor:不带本机库依赖项JavaScript XSLT处理器 开发技术 - 其它.zip (32个子文件)
xslt-processor-master
ChangeLog 5KB
.eslintrc.js 9KB
.travis.yml 38B
test_src
xpath_script.js 1KB
xslt_script.js 909B
simplelog.js 2KB
src
xmltoken.js 7KB
xslt.js 21KB
xpath.js 76KB
dom.js 14KB
util.js 9KB
index.js 123B
xpathdebug.js 6KB
AUTHORS 55B
LICENSE 7KB
tests
local-name.test.js 2KB
xmltoken.test.js 32KB
xslt.test.js 5KB
escape.test.js 2KB
simple.test.js 926B
xpath.test.js 24KB
dom.test.js 4KB
.babelrc 137B
docs
original_license.txt 2KB
package.json 1KB
rollup.config.js 396B
.npmignore 32B
TODO.md 268B
test
xslt.html 1KB
xpath.html 367B
.gitignore 79B
README.md 3KB
A
共 32 条
- 1
资源评论
处处清欢
- 粉丝: 149
- 资源: 2471
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功