How to use the fontoxpath.evaluateXPath.XQUERY_3_1_LANGUAGE 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 / FunctionCall.tests.ts View on Github external
evaluateXPathToBoolean(
				`
declare namespace test = "test";

declare function test:test () as xs:string {
  <element>XXX</element>
};

let $ret := test:test()
return $ret instance of xs:string and $ret = "XXX"
`,
				null,
				null,
				null,
				{
					language: evaluateXPath.XQUERY_3_1_LANGUAGE,
					nodesFactory: documentNode
				}
			),
			true
		);
	});
github FontoXML / fontoxpath / test / specs / parsing / xquery / AttributeConstructor.tests.ts View on Github external
it('can create an attribute with asynchronous', async () => {
		const attribute = await evaluateXPathToAsyncSingleton(
			`
		declare namespace fontoxpath="http://fontoxml.com/fontoxpath";
		attribute {fontoxpath:sleep("attr", 100)} {fontoxpath:sleep("val", 100)}`,
			documentNode,
			undefined,
			{},
			{ language: evaluateXPath.XQUERY_3_1_LANGUAGE }
		);

		chai.assert.equal(attribute.nodeType, 2);
		chai.assert.equal(attribute.name, 'attr');
		chai.assert.equal(attribute.value, 'val');
	});
});
github FontoXML / fontoxpath / test / specs / parsing / functions / builtInFunctions.dataTypeConstructors.tests.ts View on Github external
it('xs:QName() with prefix declared in an element constructor', () =&gt; {
				chai.assert.isTrue(
					evaluateXPathToBoolean(
						'{xs:QName("prefix:abc")}',
						documentNode,
						null,
						null,
						{ language: evaluateXPath.XQUERY_3_1_LANGUAGE }
					)
				);
			});
			it('xs:QName() with unknown prefix', () =&gt;
github FontoXML / fontoxpath / test / specs / parsing / functions / functions.node.tests.ts View on Github external
it('returns the root of the given constructed element', () =&gt;
			chai.assert.isTrue(
				evaluateXPathToBoolean(
					`
let $element := ,
	$node := $element//node
return root($node) = $element`,
					documentNode,
					null,
					null,
					{ language: evaluateXPath.XQUERY_3_1_LANGUAGE }
				)
			));
github FontoXML / fontoxpath / test / specs / parsing / LetExpression.tests.ts View on Github external
it('defined prefixless variables in the empty namespace', () =&gt; {
		chai.assert.isTrue(
			evaluateXPathToBoolean(
				'<element xmlns="XXX">{let $x := "A" return $Q{}x}</element> = "A"',
				documentNode,
				null,
				null,
				{ language: evaluateXPath.XQUERY_3_1_LANGUAGE }
			)
		);
	});
});
github FontoXML / fontoxpath / test / specs / parsing / xquery / VariableDeclaration.tests.ts View on Github external
it('allows external variables with defaults and external parameters', () =&gt; {
		chai.assert.equal(
			evaluateXPathToString(
				`declare variable $nxa as xs:integer external := 10; 
                {$nxa}`,
				documentNode,
				undefined,
				{ nxa: 33 },
				{ language: evaluateXPath.XQUERY_3_1_LANGUAGE }
			),
			'33'
		);
	});
github FontoXML / fontoxpath / test / specs / parsing / path / PathExpression.tests.ts View on Github external
it('sorts //text() across different levels correctly', () =&gt; {
		chai.assert.equal(
			evaluateXPathToString(
				'let $dom := Wilheit, T. T., 1986: Some comments on passive microwave measurement of rain. <source>Bull. Amer. Meteor. Soc., 67, 1226–1232, doi:10.1175/1520-0477(1986)067&lt;1226:SCOPMM&gt;2.0.CO;2 return $dom//text() =&gt; string-join("~~")',
				documentNode,
				null,
				null,
				{ language: evaluateXPath.XQUERY_3_1_LANGUAGE }
			),
			'Wilheit~~, ~~T. T.~~, ~~1986~~: ~~Some comments on passive microwave measurement of rain.~~Bull. Amer. Meteor. Soc.~~, ~~67~~, ~~1226~~–~~1232~~, doi:~~10.1175/1520-0477(1986)067&lt;1226:SCOPMM&gt;2.0.CO;2'
		);
	});
github FontoXML / fontoxpath / test / specs / parsing / mainModules.tests.js View on Github external
it('can declare a namespace', () => {
		const result = evaluateXPath(
			`
declare namespace prrt = "http://www.w3.org/2005/xpath-functions";

prrt:true()
`,
			null,
			null,
			null,
			null,
			{ language: evaluateXPath.XQUERY_3_1_LANGUAGE });

		chai.assert.equal(result, true);

	});
});
github FontoXML / fontoxpath / test / specs / parsing / xquery / PIConstructor.tests.ts View on Github external
it('can create a PI with asynchronous', async () => {
		chai.assert.equal(
			(
				await evaluateXPathToAsyncSingleton(
					`
		declare namespace fontoxpath="http://fontoxml.com/fontoxpath";
		processing-instruction {fontoxpath:sleep("my-pi",100)} {fontoxpath:sleep("data", 100)}`,
					documentNode,
					undefined,
					{},
					{ language: evaluateXPath.XQUERY_3_1_LANGUAGE }
				)
			).nodeType,
			7
		);
	});
});
github FontoXML / fontoxpath / test / specs / parsing / xquery / DefaultFunctionNamespace.tests.ts View on Github external
() =>
				evaluateXPathToBoolean(
					'declare default function namespace "http://www.w3.org/XML/1998/namespace"; declare %private function lt() as item()*{ true() }; Q{"http://www.w3.org/XML/1998/namespace"}lt()',
					documentNode,
					undefined,
					{},
					{ language: evaluateXPath.XQUERY_3_1_LANGUAGE }
				),
			'XQST0070: The prefixes xml and xmlns may not be used in a namespace declaration or be bound to another namespaceURI.'