Skip to content

How to load xslt-style defined functions in schema? #72

@wstaelens

Description

@wstaelens

I've got a schematron (v1.31).

It contains xslt-style defined functions.

One example:

<ns prefix="u" uri="utils" />


	<function xmlns="http://www.w3.org/1999/XSL/Transform" name="u:slack" as="xs:boolean">
		<param name="exp" as="xs:decimal" />
		<param name="val" as="xs:decimal" />
		<param name="slack" as="xs:decimal" />
		<value-of select="xs:decimal($exp + $slack) &gt;= $val and xs:decimal($exp - $slack) &lt;= $val" />
	</function>

when running code which uses the XPath2 lib I get: 'The function '' was not found in namespace ''.
How

Image

I call the code with:

XPath2Expression.Compile(assert.Test, nsManager);

nsManager is a new XmlNamespaceManager(nameTable); where nameTable contains u:

Image

Call Stack:

 	XPath2.dll!Wmhelp.XPath2.AST.FuncNode.FuncNode(Wmhelp.XPath2.XPath2Context context, string name, string ns, System.Collections.Generic.List<object> nodes) Line 41	C#
 	XPath2.dll!Wmhelp.XPath2.YYParser.yyparse(Wmhelp.XPath2.yyParser.yyInput yyLex) Line 657	C#
 	XPath2.dll!Wmhelp.XPath2.YYParser.yyparse(Wmhelp.XPath2.yyParser.yyInput yyLex, object yyd) Line 159	C#
 	XPath2.dll!Wmhelp.XPath2.YYParser.yyparseSafe(Wmhelp.XPath2.Tokenizer tok, object yyDebug) Line 60	C#
 	XPath2.dll!Wmhelp.XPath2.YYParser.yyparseSafe(Wmhelp.XPath2.Tokenizer tok) Line 53	C#
 	XPath2.dll!Wmhelp.XPath2.XPath2Expression.Compile(string xpath, System.Xml.IXmlNamespaceResolver resolver) Line 171	C#

the FunctionTable.Inst contains 138 items but function 'slack' seems to be missing.

Is there a way to add these xslt-style functions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions