Skip to content
Pâté is a simple Template Engine for declarative XPath templates
Branch: master
Clone or download
benoror Merge pull request #1 from gitter-badger/gitter-badge
Add a Gitter chat badge to README.md
Latest commit 869a6e8 Jun 1, 2015

README.md

logo

NPM

About Pâté

Join the chat at https://gitter.im/benoror/node-pate

Pâté (/ˈpæteɪ/) is an XPath templete engine for Node.js, also compatible with Express framework

Features

  • Support for simple XPath selectors
  • Formatting via external lib
  • Compatible with Express view engine

Installation

npm install node-pate

Dependencies

Pâté depends on libxmljs, thus compilation is needed via node-gyp

Dependencies (more info):

Basic usage

gifcast

Express example

Application:

var express = require('express');
var app = express();
var router = express.Router();

var pate = require('node-pate');
var formatter = require('./format_lib.js')

// view engine setup
app.engine('html', pate.__express);
app.set('views', path.join(__dirname, 'views'));

...

router.get('/test', function(req, res, next) {
  res.render('templates/test.html', {
    xml: '<data><row><bread name="Bretzel" price="42.56" /></row></data>',
    xpath: '/*/*',
    format_lib: formatter
  });
});

Test:

cd test-express && node bin/www

Go to: http://localhost:3000/test

Namespaces

To use a namespace put it inside the options object in the form:

ns: {
    prefix: 'URI'
}

Status

This software is still evolving. There are likely cases that it cannot handle, so file a feature request in github if there is something you think it should do.

Limitations

  • No array iteration support
  • Ugly logo ):

Inspirations

License

Pâté is provided under the MIT free software license. See the file LICENSE for the full text.

You can’t perform that action at this time.