You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Corin Moss <co...@eunomia.co.nz> on 2005/04/18 17:46:03 UTC

Registering and using JXPath extension functions from binding

Hi All,

I'm trying to use the (fairly straight-forward) JXPath extension
mechanism as described here: 

http://jakarta.apache.org/commons/jxpath/apidocs/org/apache/commons/jxpath/JXPathContext.html

However I am then unable to reference the function defined.  The
following is an example of what I'm doing:

var formObj = new Packages.nz.co.eunomia.FormattingObjects;
			
jxpathContext.setFunctions(
	new Packages.org.apache.commons.jxpath.ClassFunctions(
					formObj.getClass(), "eunomia"
				)
			);
		
Followed by: 

this.lookupWidget("timeslot_container").setSelectionList(collection,
"string(./id)", "eunomia:date(./timeslotDate, 'dd/MM/yyyy')")

Which results in:

org.apache.cocoon.ProcessingException: Error executing pipeline.:
org.apache.commons.jxpath.JXPathException: Undefined function:
eunomia:date

I can only assume that the jxpathContext object used by the
setSelectionList is different to the one I'm registering my functions
against.

Has anyone managed to get this to work successfully?  Not that the
formObj object extends java.lang.Object, as you can't call the class
field from flowscript - I think that it's a reserved word in ECMAScript.

Looking forward to any insight ;)

Corin


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org