xuriella

API Reference

xuriella

XSL

  • Macro ELEMENT ((name &key namespace use-attribute-sets) &body body)
  • Macro LITERAL-ELEMENT ((name &optional uri) &body body)
  • Macro ATTRIBUTE ((name &key namespace) &body body)
  • Macro LITERAL-ATTRIBUTE ((name &optional uri) &body body)
  • Macro TEXT (str)
  • Macro PROCESSING-INSTRUCTION (name &body body)
  • Macro COMMENT (&body body)
  • Macro VALUE-OF (xpath)
  • Macro UNESCAPED-VALUE-OF (xpath)
  • Macro FOR-EACH (select &body decls-and-body)
  • Macro MESSAGE (&body body)
  • Macro TERMINATE (&body body)
  • Macro APPLY-TEMPLATES ((&key select mode) &body decls-and-body)
  • Macro CALL-TEMPLATE (name &rest parameters)
  • Macro COPY-OF (xpath)

XURIELLA-EXTENSIONS

No exported symbols.

XURIELLA

Xuriella is an implementation of XSLT 1.0.

    @begin[Using XSLT]{section}
      XSLT stylesheets are invoked using the @code{apply-stylesheet} function,
      which can parse, compile, and apply XSLT stylesheets.

      Top-level parameters to the stylesheet can be specified using
      parameter instances created by @fun{make-parameter}.

      @aboutfun{apply-stylesheet}
      @aboutclass{parameter}
      @aboutfun{make-parameter}
    @end{section}
    @begin[Compiling stylesheets explicitly]{section}
      @code{parse-stylesheet} allows the compilation of XSLT stylesheets into
      objects ahead of time, so that @code{apply-stylesheet} only needs to
      invoke the pre-compiled sheet rather than having to parse and
      compile it first.

      @aboutfun{parse-stylesheet}
      @aboutclass{stylesheet}
    @end{section}
    @begin[Profiling support]{section}
     The profiling facility records the run time of XSLT templates.

     @aboutfun{enable-profiling}
     @aboutfun{disable-profiling}
     @aboutfun{report}
    @end{section}
    @begin[Defining extension elements]{section}
      Xuriella can be extended in two ways:

      Custom XPath functions can be implemented using the extension
      mechanism in @a[http://common-lisp.net/project/plexippus-xpath/atdoc/pages/xpath-sys.html]{Plexippus}.

      Custom XSLT elements can be implemented using the following macros.

      @code{define-extension-group} is used to establish a namespace for
      the extensions, which can then be activated using a namespace declaration
      and the @code{extension-element-prefixes} attribute in the stylesheet.

      Every individual extension element needs at least a definition
      using @code{define-extension-parser}.  The parser will run at
      compilation time and return an XSLT instruction in a sexp syntax.
      If the extension can be implemented as a transformation into ordinary
      XSLT elements, the parser only needs to return that XSLT sexp.

      In addition, the sexp representation itself can be extended using
      @code{define-extension-compiler}.  The extension compiler will be
      invoked while the stylesheet is compiled to return a function, usually
      a closure, that will be called by the stylesheet at run-time.

      @aboutmacro{define-extension-group}
      @aboutmacro{define-extension-parser}
      @aboutmacro{define-extension-compiler}
    @end{section}
    @begin[Functions useful in extensions]{section}
      The following functions can be used by extension parsers and compilers,
      to parse child nodes as instructions, or to compile such instructions,
      respectively.

      @aboutfun{parse-body}
      @aboutfun{compile-instruction}
    @end{section}
  • Condition XSLT-ERROR  (SIMPLE-ERROR)
    The class of all XSLT errors.
  • Function XSLT-ERROR (fmt &rest args)
    @unexport{}
  • Struct STYLESHEET
    MODES
    GLOBAL-VARIABLES
    OUTPUT-SPECIFICATION
    STRIP-TESTS
    STRIP-THUNK
    NAMED-TEMPLATES
    ATTRIBUTE-SETS
    KEYS
    NAMESPACE-ALIASES
    DECIMAL-FORMATS
    INITIAL-GLOBAL-VARIABLE-THUNKS
  • Function PARSE-STYLESHEET (designator &key uri-resolver)
    @arg[designator]{an XML designator} @arg[uri-resolver]{optional function of one argument} @return{An instance of @class{stylesheet}.} @short{Parse a stylesheet.} This function parses and compiles an XSLT stylesheet. The precompiled stylesheet object can then be passed to @fun{apply-stylesheet}. Also refer to @fun{apply-stylesheet} for details on XML designators.
  • Struct PARAMETER
    URI
    LOCAL-NAME
    VALUE
  • Function PARAMETER-URI (instance)
  • Function (setf PARAMETER-URI) (value instance)
  • Function PARAMETER-LOCAL-NAME (instance)
  • Function (setf PARAMETER-LOCAL-NAME) (value instance)
  • Function PARAMETER-VALUE (instance)
  • Function (setf PARAMETER-VALUE) (value instance)
  • Function MAKE-PARAMETER (value local-name &optional (uri ""))
  • Function APPLY-STYLESHEET (stylesheet source-designator &key output parameters uri-resolver navigator)
    @arg[stylesheet]{a stylesheet designator (see below for details)} @arg[source-designator]{a source document designator (see below for details)} @arg[output]{optional output sink designator (see below for details)} @arg[parameters]{a list of @class{parameter} instances} @arg[uri-resolver]{optional function of one argument} @arg[navigator]{optional XPath navigator} @return{The value returned by sax:end-document when called on the designated output sink.} @short{Apply a stylesheet to a document.} This function takes @code{stylesheet} (either a parsed @class{stylesheet} or a designator for XML file to be parsed) and a source document, specified using the XML designator @code{source-designator}, and applies the stylesheet to the document. An XML designator is any value accepted by @code{cxml:parse}, in particular: @begin{ul} @item{Pathnames -- The file referred to by the pathname will parsed using cxml.} @item{Stream -- The stream will be parsed using cxml.} @item{Xstream -- Similar to the stream case, but using cxml's internal representation of rune streams.} @item{String -- The string itself will be parsed as an XML document, and is assumed to have been decoded into characters already.} @item{Array of (unsigned-byte 8) -- The array itself will be parsed as an XML document (which has not been decoded yet).} @end{ul} Note: Since strings are interpreted as documents, namestrings are not acceptable. Use pathnames instead of namestrings. An output sink designator is has the following form: @begin{ul} @item{Null -- Designates a string sink. I.e., the result document of the stylesheet will be returned as a string. This as the default.} @item{Pathnames -- The file referred to by the pathname will created and written to.} @item{Stream -- The stream will be written to.} @item{SAX or HAX handler -- Events will be sent directly to this sink.} @end{ul} Note: Specificaton of a sink overrides the specification of XML or HTML output method in the styl.sheet. Parameters are identified by names, and have values that are strings. Top-level parameters of these names are bound accordingly. If a paramater is not specified, its default value is computed as implemented in the stylesheet. If parameters are specified that the stylesheet does not recognize, they will be ignored. A @code{uri-resolver} is a function taking a PURI object as an argument and returning a PURI object as a value. The URI resolver will be invoked for all references to external files, e.g. at compilation time using xsl:import and xsl:include, and at run-time using the document() function. The URI resolver can be used to rewrite URLs so that file http:// links are replaced by file:// links, for example. Another application are URI resolvers that signal an error instead of returning, for example so that file:// links forbidden. The specified @code{navigator} will be passed to XPath protocol functions. @see{parse-stylesheet}
  • Function COMPILE-INSTRUCTION (form env)
    @arg[form]{An XSLT instruction in sexp representation} @arg[env]{An XSLT environment} @return{A compiled function} @short{Compiles an XSLT instruction.} This function is for use in XSLT extensions. When defining an extension using @macro{define-extension-compiler}, pass body forms of the extension that should be interpreted as XSLT instructions to this function. The environment is an opaque object, which can be obtained using the @code{&environment} lambda list keyword in the extension compiler.
  • Function PARSE-BODY (node &optional (start 0) (param-names 'nil))
    @arg[node]{A node representing part of a stylesheet.} @arg[start]{An optional integer, defaulting to 0.} @arg[param-names]{Undocumented.} @return{An list of XSLT instructions in sexp syntax} @short{Parses the children of an XSLT instruction.} This function is for use in XSLT extensions. When defining an extension using @fun{define-extension-parser}, it can be used to parse the children of the extension node using regular XSLT syntax recursively. Specify @code{start} to skip the first @code{start} child nodes.
  • Macro DEFINE-EXTENSION-GROUP (name uri &optional documentation)
    @arg[name]{The name of the XSLT extension group (a symbol)} @arg[uri]{Namespace URI for the extension elements (a string)} @arg[documentation]{Documentation string for the XPath extension} @short{Defines an XSLT extension group with specified short @code{name} and namespace @code{uri}.} An XSLT extension group is a collection of XSLT element that are defined using @fun{define-extension-parser}.
  • Macro DEFINE-EXTENSION-PARSER (ext name (node-var) &body body)
    @arg[ext]{The name of an XSLT extension group (a symbol)} @arg[name]{Local name of the extension element (a string)} @arg[node-var]{Variable name for the node to be parsed, a symbol.} @arg[body]{Lisp forms, an implicit progn} @short{Defines a parser an extension element.} The parser function defined by this macro will be invoked when an XSLT extension element is encountered that has the namespace URI of the specified extension group and the local-name of this parser. @code{body} should return an XSLT instruction in sexp syntax. As a (very hypothetical) example, if the return value is computed using @begin{pre} `(xsl:text ,(princ-to-string node-var)) @end{pre} the stylesheet will emit a text node at run time, with the string representation of the instruction node as a value. Alternatively, a form can be returned that refers to user-specific compiler extensions: @begin{pre} `(your-package::frob ,(stp:attribute-value node-var "frob-arg")) @end{pre} Use @fun{define-extension-compiler} to implement an extension like @code{frob}.
  • Macro DEFINE-EXTENSION-COMPILER (symbol (&rest lambda-list) &body body)
    @arg[symbol]{The name of the extension, a symbol} @arg[lambda-list]{A destructuring lambda list, optionaly augmented using &environment} @arg[body]{Lisp forms, an implicit progn} Defines @code{symbol} as a name to be used in Xuriella's sexp representation for XSLT. It used when XSLT in sexp syntax includes a list of the form: @begin{pre}(symbol ...arguments...)@end{pre} The list @code{arguments} is then destructured using the specified lambda list, and @code{body} is invoked during compilation time as an implicit progn. @code{body} should return a function of one argument, which will be called at run time with a context object as an argument. @see{compile-instruction}
  • Function ENABLE-PROFILING
    @return{nil} @short{Enables profiling.} Resets any existing profile samples and enables profiling for future XSLT processing. Also enables XPath profiling, see @fun{xpath-sys:enable-profiling}. Profiling is not thread safe. @see{disable-profiling} @see{report}
  • Function DISABLE-PROFILING
    @return{nil} @short{Disables profiling.} Disables profiling for future XSLT processing, but keeps recorded profiling samples for @fun{report}. Also disables XPath profiling, see @fun{xpath-sys:disable-profiling}. @see{enable-profiling}
  • Function REPORT
    @short{Shows profiling output.} Shows cumulative run time and real time, number of calls, and average run time for each template that was invoked. @see{enable-profiling} @see{disable-profiling}