97a656050f4e16381a0574860153eec2127defb0
[xuriella.git] / package.lisp
blob97a656050f4e16381a0574860153eec2127defb0
1 (defpackage :xsl
2 (:nicknames :xslt)
3 (:use)
4 (:export #:template
5 #:apply-templates
6 #:apply-imports
7 #:call-template
8 #:element
9 #:literal-element
10 #:literal-attribute
11 #:attribute
12 #:text
13 #:unescaped-text
14 #:processing-instruction
15 #:comment
16 #:copy
17 #:value-of
18 #:unescaped-value-of
19 #:number
20 #:for-each
21 #:with-base-uri
22 #:copy-of
23 #:message
24 #:terminate
25 #:fallback
26 #:use-attribute-sets
28 ;; xuriella internals
29 #:with-version
30 #:with-namespaces
31 #:with-excluded-namespaces
32 #:with-extension-namespaces
33 #:with-duplicates-check))
35 (defpackage :xuriella-extensions
36 (:use)
37 (:export #:document))
39 (defpackage :xuriella
40 (:use :cl)
41 (:export #:parse-stylesheet
42 #:apply-stylesheet
43 #:stylesheet
44 #:parameter
45 #:parameter-uri
46 #:parameter-local-name
47 #:parameter-value
48 #:make-parameter
50 #:xslt-error
52 #:define-extension-group
53 #:define-extension-parser
54 #:define-extension-compiler
55 #:parse-body
56 #:compile-instruction)
57 (:import-from :xpath-protocol #:define-default-method)
58 (:documentation
59 "Xuriella is an implementation of XSLT 1.0.
61 @begin[Using XSLT]{section}
62 XSLT stylesheets are invoked using the @code{apply-stylesheet} function,
63 which can parse, compile, and apply XSLT stylesheets.
65 Top-level parameters to the stylesheet can be specified using
66 parameter instances created by @fun{make-parameter}.
68 @aboutfun{apply-stylesheet}
69 @aboutclass{parameter}
70 @aboutfun{make-parameter}
71 @end{section}
72 @begin[Compiling stylesheets explicitly]{section}
73 @code{parse-stylesheet} allows the compilation of XSLT stylesheets into
74 objects ahead of time, so that @code{apply-stylesheet} only needs to
75 invoke the pre-compiled sheet rather than having to parse and
76 compile it first.
78 @aboutfun{parse-stylesheet}
79 @aboutclass{stylesheet}
80 @end{section}
81 @begin[Defining extension elements]{section}
82 Xuriella can be extended in two ways:
84 Custom XPath functions can be implemented using the extension
85 mechanism in @a[http://common-lisp.net/project/plexippus-xpath/atdoc/pages/xpath-sys.html]{Plexippus}.
87 Custom XSLT elements can be implemented using the following macros.
89 @code{define-extension-group} is used to establish a namespace for
90 the extensions, which can then be activated using a namespace declaration
91 and the @code{extension-element-prefixes} attribute in the stylesheet.
93 Every individual extension element needs at least a definition
94 using @code{define-extension-parser}. The parser will run at
95 compilation time and return an XSLT instruction in a sexp syntax.
96 If the extension can be implemented as a transformation into ordinary
97 XSLT elements, the parser only needs to return that XSLT sexp.
99 In addition, the sexp representation itself can be extended using
100 @code{define-extension-compiler}. The extension compiler will be
101 invoked while the stylesheet is compiled to return a function, usually
102 a closure, that will be called by the stylesheet at run-time.
104 @aboutmacro{define-extension-group}
105 @aboutmacro{define-extension-parser}
106 @aboutmacro{define-extension-compiler}
107 @end{section}
108 @begin[Functions useful in extensions]{section}
109 The following functions can be used by extension parsers and compilers,
110 to parse child nodes as instructions, or to compile such instructions,
111 respectively.
113 @aboutfun{parse-body}
114 @aboutfun{compile-instruction}
115 @end{section}"))