How to use the fontoxpath.evaluateXPathToNumber function in fontoxpath

To help you get started, we’ve selected a few fontoxpath examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FontoXML / fontoxpath / test / specs / parsing / functions / builtinFunctions.duration.tests.ts View on Github external
it('returns 0 for "-P10Y10M"', () =>
			chai.assert.equal(
				evaluateXPathToNumber(
					'hours-from-duration(xs:yearMonthDuration("-P10Y10M"))',
					documentNode
				),
				0
			));
	});
github FontoXML / fontoxpath / test / specs / parsing / operators / compares / Compare.tests.ts View on Github external
it('returns the empty sequence if either operand is the empty sequence', () => {
			chai.assert.equal(evaluateXPathToNumber('count(() is ())', documentNode), 0);
		});
		it('returns the empty sequence if the lhs operand is the empty sequence', () => {
github FontoXML / fontoxpath / test / specs / parsing / functions / functions.numeric.tests.ts View on Github external
it('accepts the empty sequence', () =>
			chai.assert.isNaN(evaluateXPathToNumber('number(())', documentNode)));
github FontoXML / fontoxpath / test / specs / parsing / functions / builtinFunctions.sequences.tests.ts View on Github external
it('get sum of sequence', () =>
				chai.assert.deepEqual(
					evaluateXPathToNumber(
						'fold-left(1 to 5, 0, function($a, $b) {$a + $b})',
						documentNode
					),
					15
				));
			it('reverse sequence', () =>
github FontoXML / fontoxpath / test / specs / parsing / functions / functions.numeric.tests.ts View on Github external
it('returns 24 for 24.5', () =>
			chai.assert.equal(evaluateXPathToNumber('round-half-to-even(24.5)', documentNode), 24));
		it('returns 26 for 25.5', () =>
github FontoXML / fontoxpath / test / specs / parsing / functions / functions.fontoxpath.tests.ts View on Github external
it('also allows XQuery to be evaluated', () =>
			chai.assert.equal(
				evaluateXPathToNumber(
					'fontoxpath:evaluate("declare default function namespace ""http://www.w3.org/2005/xpath-functions/math""; exp10(3)", map{})'
				),
				1000
			));
	});
github FontoXML / fontoxpath / test / specs / parsing / maps / mapFunctions.tests.ts View on Github external
it('is aliased to "executing the map function"', () =>
			chai.assert.equal(
				evaluateXPathToNumber('(map {"a": 1, "b":2})("a")', documentNode),
				1
			));
github FontoXML / fontoxpath / test / specs / parsing / maps / mapFunctions.tests.ts View on Github external
it('returns the empty sequence for an empty map', () =>
			chai.assert.equal(evaluateXPathToNumber('count(map:keys(map{}))', documentNode), 0));
github FontoXML / fontoxpath / test / specs / parsing / functions / functions.numeric.tests.js View on Github external
			() => chai.assert.equal(evaluateXPathToNumber('round(xs:double("+INF"))', documentNode), +Infinity));
github FontoXML / fontoxpath / test / specs / parsing / operators / numeric / Unary.tests.js View on Github external
		() => chai.assert.equal(evaluateXPathToNumber('+1', documentNode), 1));