[xuriella-devel] Looking for a general approach

Andrei Stebakov lispercat at gmail.com
Fri Dec 3 18:28:31 UTC 2010


Great! Is there any way to pass parameters from XSLT to (princ-to-string ...)?
You made an example of (princ-to-string pi) which will evaluate pi on
the lisp side and return the output to XSLT.
Can we pass some parameters/variables evaluated at XSLT side to lisp
like (princ-to-string $some-xslt-var)?

On Fri, Dec 3, 2010 at 1:01 PM, David Lichteblau <david at lichteblau.com> wrote:
> Quoting Andrei Stebakov (lispercat at gmail.com):
>> Thank you, David, this is what I was looking for. Any code snippets to
>> illustrate this?
>
> (xuriella:define-extension-group :your-extension "http://yoururlhere")
>
> (xuriella:define-extension-parser :your-extension "eval" (node)
>  `(eval-this ,(stp:string-value node)))
>
> (xuriella:define-extension-compiler eval-this
>    (str &environment env)
>  (let ((form (read-from-string str)))
>    (lambda (ctx)
>      (declare (ignore ctx))
>      (xuriella::write-text (eval form)))))
>
> (defun test ()
>  (xuriella:apply-stylesheet
>   "<xsl:transform xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
>                   xmlns:x='http://yoururlhere'
>                   extension-element-prefixes='x'
>                   version='1.0'>
>      <xsl:template match='/'>
>        <x:eval>(princ-to-string pi)</x:eval>
>      </xsl:template>
>    </xsl:transform>"
>   "<test-input/>"))
>
> This example doesn't explain XPath extension functions, but these are
> covered in the Plexippus API docs.
>
>
> d.
>




More information about the xuriella-devel mailing list