[xuriella-devel] Looking for a general approach
David Lichteblau
david at lichteblau.com
Fri Dec 3 18:01:53 UTC 2010
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