lib/xp/xslt

XSLT template related functions.

Example
var xsltLib = require('/lib/xp/xslt');

Methods

(static) render(view, model) → {string}

This function renders a view using XSLT. The model is automatically transformed to XML.

Parameters:
Name Type Description
view

Location of the view. Use resolve(..) to resolve a view.

model object

Model that is passed to the view.

Returns:

The rendered output.

Type
string
Example
var view = resolve('view/fruit.xslt');
var model = {
    fruits: [
        {
            name: 'Apple',
            color: 'Red'
        },
        {
            name: 'Pear',
            color: 'Green'
        }
    ]
};

var result = xsltLib.render(view, model);