marcheur
v0.9.0
Published
Library to build simplistic XSLT-like processors
Downloads
1,813
Maintainers
Readme
Marcheur
A long, long time ago I used XSLT quite a lot, and while the verbosity was always an issue I did enjoy its tree walking and pattern-matching abilities. On occasion, I have need the same in JS, but the XSLT support there is abysmal.
This library does not intend to replace XSLT, but it can be used to build simple tree walking tools based on a the extremely simple algorithm that is at the heart of XSLT 1 processing.
Install
npm install marcheur
Example
XXX TDB
API
Core
XXX TDB
Matcher
Marcheur can match using any kind of condition. What Matcher
exposes is a really simple set of
matching conditions that are commonly needed.
XXX TDB
Nodal
This is a small utility, imported on its own, that provides an element creator and attribute remapping for a given context document and set of namespaces.
XXX TDB
qname(name, nsMap)
This function, imported on its own, will take a name (of an element or attribute) and an optional
object mapping namespace prefixes to namespace URLs. If the name is a qualified name that matches
one of the given prefixes, a { ns, ln }
object will be returned with the namespace and local name
(ie. without prefix) for the given qualified name; otherwise it will just return { qn }
being the
provided name.
XXX TDB