Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
enketo-transformer
Advanced tools
Library/app that transforms ODK-compliant XForms into a format that enketo-core consumes
NodeJS library that transforms OpenRosa/ODK XForms into a format the Enketo understands. It works both as a library module, as well as a standalone app.
npm install enketo-transformer --save
var transformer = require('enketo-transformer');
var xform = fs.readFileSync( 'path/to/xform.xml' );
transformer.transform( {
// required string of XForm
xform: xform,
// optional string, to add theme if no theme is defined in the XForm
theme: 'sometheme',
// optional map, to replace jr://..../myfile.png URLs
media: {
'myfile.png' : '/path/to/somefile.png',
'myfile.mp3' : '/another/path/to/2.mp3'
},
// optional ability to disable markdown rendering (default is true)
markdown: false,
// optional preprocess function that transforms the XForm (as libXMLJs object) to
// e.g. correct incompatible XForm syntax before Enketo's transformation takes place
preprocess: function(doc){ return doc; },
} ).then(function( result ){
// do something with result
});
npm install
npm start
GET /transform
with xform parameter (required, xform URL), orPOST /transform
with URL-encoded body including xform
(required, full XForm as a string), theme
(optional, string), and media
(optional, map) parameterssample GET request:
curl http://localhost:8085/transform?xform=https://example.com/forms/78372/form.xml
sample POST request:
curl -d "xform=<xform>x</xform>&theme=plain&media[myfile.png]=/path/to/somefile.png&media[this]=that" http://localhost:8085/transform
{
"form" : "<form>.....</form>",
"model": "<model>...</model>",
"transformerVersion": "1.13.0",
"languageMap": { "Français": "fr", "English": "en" }
}
npm test
A vagrant configuration file and provisioning script is included. Use DEBUG environment variable to see debug terminal output, e.g.:
DEBUG=api,transformer,markdown,language node app.js
See license document. Also note the additional 'powered by enketo' footer requirement of enketo-xslt which is used in this repository and therefore applicable.
See change log
FAQs
Library that transforms ODK-compliant XForms into a format that Enketo can consume
The npm package enketo-transformer receives a total of 43 weekly downloads. As such, enketo-transformer popularity was classified as not popular.
We found that enketo-transformer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.