[xuriella-devel] Question concerning custom xpath functions returning node sets

rm at tuxteam.de rm at tuxteam.de
Sun May 20 17:45:19 UTC 2012


On Sun, May 20, 2012 at 04:39:29PM +0200, David Lichteblau wrote:
> Hi,
> 
> Quoting R. Mattes (rm at mh-freiburg.de):
> > My first (naive) implementation looked like this:
> > 
> >  (xpath-sys:define-xpath-function/eager 
> >     my fun (string &optional (count 1))
> >   (loop for i from 0 to count
> >         collect string into value-list
> >         finally (return (xpath-sys:make-node-set 
> >                          (xpath-sys:make-pipe (car value-list) (cdr
> > value-list))))))
> 
> sorry for the late reply. 

No problem, thanks.

> I suspect that by now you might have come up
> with a solution yourself, so I'll keep my answer brief for now:
> 
> I think you need to return a set of nodes, whereas you have a set of
> strings, and a string as such isn't a node.
> 
> If the above is too obscure, please let me know, and I'll elaborate! :-)

It's not too obscure - but I'm still not shure how to achive my goal.
I'm looking for a public api to generate nodes. So far I've found
(dom:create-text-node  doc data) but that leaves me with two questions:
first, from within a xpath extension function there's no obvious way to
access the document being processed (I might be missing something here
but I _think_ the xpath api should provide more context).
Second: dom:create-... isn't really a good match for xpath since one
can't create some of the xpath node types (booleans, numbers etc.).

Somehow I feel this is more of a xpath api problem but maybe you 
have some idea/input on this.

 Thanks RalfD

> 
> d.
> 
> _______________________________________________
> xuriella-devel mailing list
> xuriella-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/xuriella-devel




More information about the xuriella-devel mailing list