File: xml_doc_output_option.xml

package info (click to toggle)
virtuoso-opensource 7.2.5.1%2Bdfsg1-0.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 285,240 kB
  • sloc: ansic: 641,220; sql: 490,413; xml: 269,570; java: 83,893; javascript: 79,900; cpp: 36,927; sh: 31,653; cs: 25,702; php: 12,690; yacc: 10,227; lex: 7,601; makefile: 7,129; jsp: 4,523; awk: 1,697; perl: 1,013; ruby: 1,003; python: 326
file content (129 lines) | stat: -rw-r--r-- 6,035 bytes parent folder | download | duplicates (2)
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?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_xml_doc_output_option">
  <refmeta>
    <refentrytitle>xml_doc_output_option</refentrytitle>
    <refmiscinfo>xml</refmiscinfo>
  </refmeta>
  <refnamediv>
    <refname>xml_doc_output_option</refname>
    <refpurpose></refpurpose>
  </refnamediv>
  <refsynopsisdiv>
    <funcsynopsis id="fsyn_xml_doc_output_option">
      <funcprototype id="fproto_xml_doc_output_option">
        <funcdef>varchar <function>xml_doc_output_option</function></funcdef>
	<paramdef>in <parameter>xml_entity</parameter> any</paramdef>
	<paramdef>in <parameter>option_name</parameter> varchar</paramdef>
	<paramdef><optional>in <parameter>option_value</parameter> varchar</optional></paramdef>
      </funcprototype>
    </funcsynopsis>
  </refsynopsisdiv>
  <refsect1 id="desc_xml_doc_output_option">
    <title>Description</title>
    <para>This function reads or updates the specified XSLT output option value
      of the given <code>xml_entity</code>.</para>
    <para>The function updates the option if parameter <code>option_value</code> is provided, otherwise it returns the
    current value of the option without any side effects.</para>
    <para>Supported options are "method", "version", "encoding", "omit-xml-declaration", "standalone", "doctype-public",
    	"doctype-system", "indent" and "media-type", but do not support"cdata-section-elements". When the entity is serialized,
    	the effect is very similar to the effect of the same option specified in xsl:output element of an XSLT that created
    	the entity.</para>
    <para>Note that output options are properties of the whole document, not properties of some particular node in the
    	document, so the effect of the update is document-wide. Please also note that the effect of 'preamble' options
    	"omit-xml-declaration", "standalone", "doctype-public" and "doctype-system" is visible only when the root entity
    	of the document is serialized, not any descendant entity. Even the serialization of top-level element of the
    	document is not affected by these settings. The XML preamble is serialized only if the document is composed by
    	an XSLT processor or "doctype-system" is set or at least one of two boolean properties "omit-xml-declaration"
    	and "standalone" is set to "yes".</para>
    <para>According to the DTD rules, "doctype-public" has no effect on serialization if "doctype-system" is not set.</para>
  </refsect1>
  <refsect1 id="params_xml_doc_output_option">
    <title>Parameters</title>
    <refsect2><title>xml_entity</title>
      <para>An XML entity such as that returned by the xslt() function.</para>
    </refsect2>
    <refsect2><title>option_name</title>
      <para>A name of output option to in question.</para>
    </refsect2>
    <refsect2><title>option_value</title>
      <para>A new value of output option. This is a string or NULL (that reset option to default). Allowed values of
      	boolean properties "omit-xml-declaration" and "standalone" are "yes" and "no", as it is in XSLT 1.0.</para>
    </refsect2>
  </refsect1>
  <refsect1 id="ret_xml_doc_output_option"><title>Return Types</title>
    <para>The function returns a string that is a value of the option or NULL if the option is not set.</para>
  </refsect1>
  <refsect1 id="errors_xml_doc_output_option">
    <title>Errors</title>
    <para>This function can generate the following errors:</para>
    <para><errorcode>22023</errorcode> <errorcode>SR003</errorcode> 
    Function xml_doc_output_option needs an XML entity as argument 1, not an arg of type &lt;type_name&gt; (&lt;type&gt;)</para>
  </refsect1>
  <refsect1 id="examples_xml_doc_output_option">
    <title>Examples</title>
    <example id="ex_xml_doc_output_option"><title>Assessing the SYSTEM DTD location</title>
      <screen><![CDATA[
create function test_output_option (
  in cnt any, in opt_name any, in opt_value any)
{
  declare xt, ses any;
  declare oldval, newval varchar;
  xt := xtree_doc (cnt, 2, '', 'UTF-8');
  oldval := xml_doc_output_option (xt, opt_name);
  xml_doc_output_option (xt, opt_name, opt_value);
  newval := xml_doc_output_option (xt, opt_name);
  return concat (
    sprintf ('Old value of "%s" is "%s"\nNew value is "%s"\nThe result:\n',
       opt_name,
       cast (oldval as varchar),
       cast (newval as varchar) ),
    serialize_to_UTF8_xml (xt) );
}

select test_output_option (
  '<div xmlns="http://www.w3.org/1999/xhtml">Hello</div>',
  'doctype-system', 'http://www.example.com/xhtml.dtd')
callret
VARCHAR
_______________________________________________________________________________

Old value of "doctype-system" is "(NULL)"
New value is "http://www.example.com/xhtml.dtd"
The result:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE http://www.w3.org/1999/xhtml:div
  SYSTEM "http://www.example.com/xhtml.dtd">
<n0:div xmlns:n0="http://www.w3.org/1999/xhtml">Hello</n0:div>

1 Rows. -- 1 msec.
]]>
</screen>
    </example>
  </refsect1>
  <refsect1 id="seealso_xml_doc_output_option">
    <title>See Also</title>
    <para><link linkend="fn_xtree_doc"><function>xtree_doc()</function></link></para>
  </refsect1>
</refentry>