R. Mattes | 8 May 21:42 2012

Question concerning custom xpath functions returning node sets

Dear list,

I'm trying to extend xuriella by writing some custom 
xpath functions (using plexippus' extension mechanism). 
This works fine for functions returning strings, booleans or
numbers, but I now need to write a function that returns a 
node set so that the following will work:

 <xsl:for-each select='my:fun("sample string", 3)'>
   <xsl:value-of select='pos()'/> <xsl:value-of select='.'/>

My first (naive) implementation looked like this:

    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

Testing seem to work:

CL-USER> (xpath:with-namespaces (("my" "http://my.ns")) 
             (xpath:evaluate "my:myfun('blah')" nil))
#<XPATH:NODE-SET 3, ... {CB289B1}>

A nodeset, as expected.
But using this function in a stylesheet throw the following error:
(Continue reading)

Raymond Wiker | 5 Sep 21:22 2011

Xuriella vs Lispworks

I'm mainly using Lispworks, and I've had a few problems getting Xuriella running. Looking at the
xuriella-devel archives, I see that Frank Schorr reported this back in November 2009.

I have been able to get Xuriella to work by changing the order of clauses in the loop in
xuriella::report-samples (as suggested by Frank), as well as a little bit of magic[1] that I haven't
tried to figure out until now.

First of all: the loop clause in report-samples. My interpretation of the Hyperspec indicates that the
order of clauses used in report-samples

  for base-uri being each hash-key 
  using (hash-value id)
  in base-uris …

is non-conformant; the correct order should be something like 

  for base-uri being each hash-key
  in base-uris
  using (hash-value id)

--- just like Frank suggested.

The two other issues that Frank reported are *probably* because he was running with
lw:*default-character-element-type* set to 'base-char. Doing something like

(lw:set-default-character-element-type 'character) ;; or lw:simple-char

before trying to use xuriella (or cxml-stp) appears to do the necessary magic. 
(Continue reading)