----- Original Message -----
From: "Hallvard Tratteberg" <[EMAIL PROTECTED]>
> James,
>
> > > Although in the former case the function is called once for each node
> > > ("somewhere" element) in the node set, and hence more naturally maps
to
> > > method call. In the latter case, the first argument is a node set (a
set
> > of
> > > "somewhere" Elements). Isn't that correct and doesn't that make a
> > > difference?
> >
> > Though the function could always iterate over the nodeset and execute
its
> > functionality on each node in the set, and return a new nodeset of all
the
> > results. Would that do?
>
> No. There is a difference between iterating over a set and being called as
a
> method on each object in turn. Each object may have it's own method, like
> the javascript function attached to each Element node, as in my case.

But this is an implementation detail of your model.

e.g. lets say your Element nodes have a method called foo() on them.

We could do

foo(/some/thing)/else

Then the global XPath function foo() could iterate over the nodeset of
/some/thing and call the foo() method on each Element node and return a
result set.

If you're Element.foo() method took parameters then these could follow in
the global foo() XPath function. e.g.

foo(/some/thing, 'abc')/else

would call

Element.foo( "abc" )

on each node that matches /some/thing.

So I think you can do exactly what you want - its just that you need to
create a global XPath function to call the instance method on the Element.
Indeed you could just write a generic XPath function and NamespaceContext
that attempts to use reflection to call all available methods on your
Element class automatically, so you only need to write one XPath function if
you see what I mean.

Does that help?

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to