Name
xslt_sheet — declares an XSL stylesheet for use
Synopsis
xslt_sheet
(
|
in uri varchar , |
in
entity
any
) ; |
Description
This function takes a name and the root element of a parsed XML
document and defines these as a stylesheet. The unique element child
of the entity object's document should be an xsl:stylesheet
element. Included or imported stylesheets will be located relative to
the base URI of the entity passed to
xslt_sheet()
. Once a stylesheet thus defined it
can be used as the stylesheet argument of xslt.
Parameters
uri
The location of the XSLT style sheet
entity
A valid XSL style sheet, XML entity parsed using the
xml_tree_doc()
function
Examples
Example 24.535. Preparing a Style Sheet from the File System
The xslt_view()
function first defines the style
sheet from a file. The xslt_sheet()
function is
called with the name and the root element of the parsed file.
xslt_view()
next gets the string to process,
parses the string as XML and converts the parse tree into an entity
object. This is then passed to the xslt()
function. The result is another entity object. This is finally
serialized as XML text and written into the file
xslt.out
.
create procedure xslt_view (in v varchar, in xst varchar) { declare str, r varchar; xslt_sheet (xst, xml_tree_doc (xml_tree (file_to_string (xst)))); str := xml_view_string (v); r := xslt (xst, xml_tree_doc (xml_tree (str))); declare str any; str := string_output (); http_value (r, 0, str); string_to_file ('xslt.out', string_output_string (str), 0); }