File: xml_doc_output_option.xml

package info (click to toggle)
virtuoso-opensource 6.1.4%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 245,116 kB
  • sloc: ansic: 639,631; sql: 439,225; xml: 287,085; java: 61,048; sh: 38,723; cpp: 36,889; cs: 25,240; php: 12,562; yacc: 9,036; lex: 7,149; makefile: 6,093; jsp: 4,447; awk: 1,643; perl: 1,017; ruby: 1,003; python: 329
file content (141 lines) | stat: -rw-r--r-- 6,376 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
130
131
132
133
134
135
136
137
138
139
140
141
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 -  
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2006 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 <parameter>xml_entity</parameter>.</para>
    <para>The function updates the option if parameter <parameter>option_value</parameter> is provided,
      otherwise it returns the current value of the option without any side effects.</para>
    <para>Supported options are &apos;method&apos;, &apos;version&apos;,
      &apos;encoding&apos;, &apos;omit-xml-declaration&apos;, &apos;standalone&apos;,
      &apos;doctype-public&apos;, &apos;doctype-system&apos;, &apos;indent&apos;
      and &apos;media-type&apos;, but do not support&apos;cdata-section-elements&apos;.
      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
      &apos;omit-xml-declaration&apos;, &apos;standalone&apos;,
      &apos;doctype-public&apos; and &apos;doctype-system&apos; 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
      &apos;doctype-system&apos; is set or at least one of two
      boolean properties &apos;omit-xml-declaration&apos; and &apos;standalone&apos;
      is set to &apos;yes&apos;.</para>
    <para>According to the DTD rules, &apos;doctype-public&apos; has no effect on serialization if &apos;doctype-system&apos; 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 &apos;omit-xml-declaration&apos; and &apos;standalone&apos; are &apos;yes&apos; and &apos;no&apos;, 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>