1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
-
- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- project.
-
- Copyright (C) 1998-2018 OpenLink Software
-
- This project is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; only version 2 of the License, dated June 1991.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-->
<refentry id="fn_xslt_sheet">
<refmeta>
<refentrytitle>xslt_sheet</refentrytitle>
<refmiscinfo>xml</refmiscinfo>
</refmeta>
<refnamediv>
<refname>xslt_sheet</refname>
<refpurpose>declares an XSL stylesheet for use</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="fsyn_xslt_sheet">
<funcprototype id="fproto_xslt_sheet">
<funcdef><function>xslt_sheet</function></funcdef>
<paramdef>in <parameter>uri</parameter> varchar</paramdef>
<paramdef>in <parameter>entity</parameter> any</paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="desc_xslt_sheet"><title>Description</title>
<para>
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
<function>xslt_sheet()</function>. Once a stylesheet thus defined it
can be used as the stylesheet argument of xslt.
</para>
</refsect1>
<refsect1 id="params_xslt_sheet"><title>Parameters</title>
<refsect2><title>uri</title>
<para>The location of the XSLT style sheet</para></refsect2>
<refsect2><title>entity</title>
<para>A valid XSL style sheet, XML entity parsed using the <function>xml_tree_doc()</function> function</para></refsect2>
</refsect1>
<!--
<refsect1 id="ret_xslt_sheet"><title>Return Types</title><para></para></refsect1>
<refsect1 id="errors_xslt_sheet"><title>Errors</title>
<table><title>Errors signalled by </title>
<tgroup cols="4">
<thead>
<row><entry>SQL State</entry><entry>Error Code</entry><entry>Error Text</entry><entry>Description</entry></row>
</thead>
<tbody>
<row>
<entry><errorcode></errorcode></entry>
<entry><errorcode></errorcode></entry>
<entry><errorname></errorname></entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
</refsect1>
-->
<refsect1 id="examples_xslt_sheet"><title>Examples</title>
<example id="ex_xslt_sheet"><title>Preparing a Style Sheet from the File System</title>
<para>
The <function>xslt_view()</function> function first defines the style
sheet from a file. The <function>xslt_sheet()</function> function is
called with the name and the root element of the parsed file.
<function>xslt_view()</function> 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 <function>xslt()</function>
function. The result is another entity object. This is finally
serialized as XML text and written into the file
<parameter>xslt.out</parameter>.
</para>
<programlisting>
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);
}
</programlisting>
</example>
</refsect1>
<refsect1 id="seealso_xslt_sheet"><title>See Also</title>
<para><link
linkend="fn_xml_tree_doc"><function>xml_tree_doc()</function></link></para>
</refsect1>
</refentry>
|