Check xsl:output/standalone
[xuriella.git] / trace.lisp
blob2474bbee376463ee2739c20d4e229e8808ea3804
1 (in-package :xuriella)
3 (defparameter *xslt-trace* nil)
4 (defparameter *xslt-trace-context* nil)
5 (defparameter *xslt-trace-indent* 2)
7 (defvar *xslt-trace-level* 0)
9 (defun xslt-trace (fmt &rest args)
10 (when *xslt-trace*
11 (format *debug-io* "~&~v@T~?~%"
12 (* *xslt-trace-level* *xslt-trace-indent*)
13 fmt args)))
15 (defun xslt-trace-thunk (thunk fmt &rest other-args)
16 (if *xslt-trace*
17 #'(lambda (ctx)
18 (format *debug-io* "~&~v@TENTER: ~?~%"
19 (* *xslt-trace-level* *xslt-trace-indent*)
20 fmt (substitute "..." :result other-args))
21 (let ((result (let ((*xslt-trace-level* (1+ *xslt-trace-level*)))
22 (funcall thunk ctx))))
23 (format *debug-io* "~&~v@TLEAVE: ~@[(CONTEXT: ~s)~%~]~?~%"
24 (* *xslt-trace-level* *xslt-trace-indent*)
25 (and *xslt-trace-context* (xpath:context-node ctx)) fmt
26 (substitute result :result other-args))
27 result))
28 thunk))