All Projects → fiduswriter → Xslt Processor

fiduswriter / Xslt Processor

Licence: lgpl-3.0
A JavaScript XSLT processor without native library dependencies

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Xslt Processor

Tikxml
Modern XML Parser for Android
Stars: ✭ 370 (+640%)
Mutual labels:  xml, xml-parser
Quick Xml
Rust high performance xml reader and writer
Stars: ✭ 480 (+860%)
Mutual labels:  xml, xml-parser
Camaro
camaro is an utility to transform XML to JSON, using Node.js binding to native XML parser pugixml, one of the fastest XML parser around.
Stars: ✭ 438 (+776%)
Mutual labels:  xml, xml-parser
fox
A Fortran XML library
Stars: ✭ 51 (+2%)
Mutual labels:  xml, xml-parser
Fuzi
A fast & lightweight XML & HTML parser in Swift with XPath & CSS support
Stars: ✭ 894 (+1688%)
Mutual labels:  xml, xml-parser
Hquery.php
An extremely fast web scraper that parses megabytes of invalid HTML in a blink of an eye. PHP5.3+, no dependencies.
Stars: ✭ 295 (+490%)
Mutual labels:  xml, xml-parser
Xmlcoder
Easy XML parsing using Codable protocols in Swift
Stars: ✭ 460 (+820%)
Mutual labels:  xml, xml-parser
Xmlquery
xmlquery is Golang XPath package for XML query.
Stars: ✭ 209 (+318%)
Mutual labels:  xml, xml-parser
Easyxml
Simplifies parsing and modifying of (huge) XML streams (files) based on the StAX parser with combination of JAXB or JDom2
Stars: ✭ 6 (-88%)
Mutual labels:  xml, xml-parser
Dasel
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.
Stars: ✭ 759 (+1418%)
Mutual labels:  xml, xml-parser
xgen
XSD (XML Schema Definition) parser and Go/C/Java/Rust/TypeScript code generator
Stars: ✭ 153 (+206%)
Mutual labels:  xml, xml-parser
Cheatyxml
CheatyXML is a Swift framework designed to manage XML easily
Stars: ✭ 23 (-54%)
Mutual labels:  xml, xml-parser
Posthtml
PostHTML is a tool to transform HTML/XML with JS plugins
Stars: ✭ 2,737 (+5374%)
Mutual labels:  xml, xml-parser
Node Rest Client
REST API client from node.js
Stars: ✭ 365 (+630%)
Mutual labels:  xml, xml-parser
Pugixml
Light-weight, simple and fast XML parser for C++ with XPath support
Stars: ✭ 2,809 (+5518%)
Mutual labels:  xml, xml-parser
Node Xml2js
XML to JavaScript object converter.
Stars: ✭ 4,402 (+8704%)
Mutual labels:  xml, xml-parser
Parse Xml
A fast, safe, compliant XML parser for Node.js and browsers.
Stars: ✭ 184 (+268%)
Mutual labels:  xml, xml-parser
Saxy
A fast, easy-to-use and XML 1.0 compliant XML SAX parser in Elixir
Stars: ✭ 192 (+284%)
Mutual labels:  xml, xml-parser
Libexpat
🌿 Expat library: Fast streaming XML parser written in C; in the process of migrating from SourceForge to GitHub
Stars: ✭ 549 (+998%)
Mutual labels:  xml, xml-parser
Xylophone
Xylophone
Stars: ✭ 23 (-54%)
Mutual labels:  xml, xml-parser

XSLT-processor

Build Status

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:

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:

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 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 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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].