1 /** 2 * @fileoverview A collection of custom XRX++ XPath functions. 3 */ 4 5 goog.provide('xrx.func'); 6 7 8 goog.require('xrx.model'); 9 goog.require('xrx.xpath'); 10 goog.require('xrx.xpath.DataType'); 11 goog.require('xrx.xpath.FunctionCall'); 12 goog.require('xrx.xpath.NodeSet'); 13 14 15 16 xrx.xpath.declareNamespace('xrx', 'http://www.monasterium.net/NS/xrx'); 17 18 19 20 xrx.func = { 21 INSTANCE: xrx.xpath.FunctionCall.createFunc('xrx:instance', 22 xrx.xpath.DataType.NODESET, true, true, true, 23 function(ctx, expr) { 24 var nodeset = new xrx.xpath.NodeSet(); 25 var instance = expr.evaluate(ctx); 26 nodeset.add(xrx.model.getComponent(instance).document()); 27 28 return nodeset; 29 }, 1, 1) 30 }; 31