Package docstring
[xuriella.git] / package.lisp
blob1f06d633e1021c3aa85a17331604ca2d3a29f4e8
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 ;; Extensions
29 #:document ;fixme: incompatible with XSLT 2.0
31 ;; xuriella internals
32 #:with-version
33 #:with-namespaces
34 #:with-excluded-namespaces
35 #:with-extension-namespaces
36 #:with-duplicates-check))
38 (defpackage :xuriella-extensions
39 (:use)
40 (:export #:document))
42 (defpackage :xuriella
43 (:use :cl)
44 (:export #:parse-stylesheet
45 #:apply-stylesheet
46 #:make-parameter
48 #:define-extension-group
49 #:define-extension-parser
50 #:define-extension-compiler
51 #:parse-body
52 #:compile-instruction)
53 (:import-from :xpath-protocol #:define-default-method)
54 (:documentation
55 "Xuriella is an implementation of XSLT 1.0.
57 @begin[Using XSLT]{section}
58 XSLT stylesheets are invoked using the @code{apply-stylesheet} function,
59 which can parse, compile, and apply XSLT stylesheets.
61 Top-level parameters to the stylesheet can be specified using
62 parameter instances created by @fun{make-parameter}.
64 @aboutfun{apply-stylesheet}
65 @aboutfun{make-parameter}
66 @end{section}
67 @begin[Compiling stylesheets explicitly]{section}
68 @code{parse-stylesheet} allows the compilation of XSLT stylesheets into
69 objects ahead of time, so that @code{apply-stylesheet} only needs to
70 invoke the pre-compiled sheet rather than having to parse and
71 compile it first.
73 @aboutfun{parse-stylesheet}
74 @end{section}
75 @begin[Defining extension elements]{section}
76 Xuriella can be extended in two ways:
78 Custom XPath functions can be implemented using the extension
79 mechanism in @a[http://common-lisp.net/project/plexippus-xpath/atdoc/pages/xpath-sys.html]{Plexippus}.
81 Custom XSLT elements can be implemented using the following macros.
83 @code{define-extension-group} is used to establish a namespace for
84 the extensions, which can then be activated using a namespace declaration
85 and the @code{extension-element-prefixes} attribute in the stylesheet.
87 Every individual extension element needs at least a definition
88 using @code{define-extension-parser}. The parser will run at
89 compilation time and return an XSLT instruction in a sexp syntax.
90 If the extension can be implemented as a transformation into ordinary
91 XSLT elements, the parser only needs to return that XSLT sexp.
93 In addition, the sexp representation itself can be extended using
94 @code{define-extension-compiler}. The extension compiler will be
95 invoked while the stylesheet is compiled to return a function, usually
96 a closure, that will be called by the stylesheet at run-time.
98 @aboutmacro{define-extension-group}
99 @aboutmacro{define-extension-parser}
100 @aboutmacro{define-extension-compiler}
101 @end{section}
102 @begin[Functions useful in extensions]{section}
103 The following functions can be used by extension parsers and compilers,
104 to parse child nodes as instructions, or to compile such instructions,
105 respectively.
107 @aboutfun{parse-body}
108 @aboutfun{compile-instruction}
109 @end{section}"))