1 package dbms_xslprocessor authid current_user as
2
3 /**
4 * Processor interface type
5 */
6 TYPE Processor IS RECORD (id dbms_xmldom.domtype);
7 /* SUBTYPE Processor IS RAW(8); */
8
9 /**
10 * Stylesheet interface type
11 */
12 TYPE Stylesheet IS RECORD (id dbms_xmldom.domtype);
13 /* SUBTYPE Stylesheet IS RAW(8); */
14
15 /**
16 * Internal error
17 */
18 INTERNAL_ERR CONSTANT NUMBER := -20000;
19
20 /**
21 * Other errors
22 */
23 PROCESSOR_ERR CONSTANT NUMBER := -20100;
24 FILE_ERR CONSTANT NUMBER := -20101;
25 CONN_ERR CONSTANT NUMBER := -20102;
26 NULL_ERR CONSTANT NUMBER := -20103;
27
28 /**
29 * Read from a file to a clob, return clob
30 */
31 function read2clob(flocation VARCHAR2, fname VARCHAR2, csid IN NUMBER := 0)
32 RETURN clob;
33
34 /**
35 * Write from a clob to a file with given character encoding.
36 * If csid is zero or not given then the file will be in the db charset.
37 */
38 procedure clob2file(cl clob, flocation VARCHAR2, fname VARCHAR2,
39 csid IN NUMBER := 0);
40
41 /**
42 * Returns a new processor instance
43 */
44 FUNCTION newProcessor RETURN Processor;
45
46 /**
47 * Free XSL Processor
48 */
49 PROCEDURE freeProcessor(p Processor);
50
51 /**
52 * Transforms input XML document using given DOMDocument and stylesheet
53 */
54 FUNCTION processXSL(p Processor, ss Stylesheet, xmldoc dbms_xmldom.DOMDocument)
55 return dbms_xmldom.DOMDocumentFragment;
56
57 /**
58 * Transforms input XML document using given Doc as CLOB
59 */
60 FUNCTION processXSL(p Processor, ss Stylesheet, cl clob)
61 return dbms_xmldom.DOMDocumentFragment;
62
63 /**
64 * Transforms input XML document using given DOMDocument and stylesheet
65 * and writes output to a file
66 */
67 PROCEDURE processXSL(p Processor, ss Stylesheet,
68 xmldoc dbms_xmldom.DOMDocument, dir varchar2, fileName varchar2);
69
70 /**
71 * Transforms input XML document using given as URL and stylesheet
72 * and writes output to a file
73 */
74 PROCEDURE processXSL(p Processor, ss Stylesheet,
75 url varchar2, dir varchar2, fileName varchar2);
76
77 /**
78 * Transforms input XML document using given DOMDocument and stylesheet
79 * and writes output to a buffer
80 */
81 PROCEDURE processXSL(p Processor, ss Stylesheet,
82 xmldoc dbms_xmldom.DOMDocument, buffer in out varchar2);
83
84 /**
85 * Transforms input XML document using given DOMDocument and stylesheet
86 * and writes output to a CLOB
87 */
88 PROCEDURE processXSL(p Processor, ss Stylesheet,
89 xmldoc dbms_xmldom.DOMDocument, cl in out clob);
90
91 /**
92 * Transforms input XML document using given DOMDocument and stylesheet
93 * and writes output to a CLOB. Provides information if style sheet output
94 * method is xml or not.
95 */
96 PROCEDURE processXSL(p Processor, ss Stylesheet,
97 xmldoc dbms_xmldom.DOMDocument,
98 cl in out clob, isoutputxml out boolean);
99
100 /**
101 /**
102 * Transforms input XML document fragment using given DOMDocumentFragment and
103 * stylesheet
104 */
105 FUNCTION processXSL(p Processor, ss Stylesheet,
106 xmldf dbms_xmldom.DOMDocumentFragment)
107 return dbms_xmldom.DOMDocumentFragment;
108
109 /**
110 * Transforms input XML document fragment using given DOMDocumentFragment
111 * and stylesheet and writes output to a file
112 */
113 PROCEDURE processXSL(p Processor, ss Stylesheet,
114 xmldf dbms_xmldom.DOMDocumentFragment, dir varchar2, fileName varchar2);
115
116 /**
117 * Transforms input XML document fragment using given DOMDocumentFragment
118 * and stylesheet and writes output to a buffer
119 */
120 PROCEDURE processXSL(p Processor, ss Stylesheet,
121 xmldf dbms_xmldom.DOMDocumentFragment, buffer in out varchar2);
122
123 /**
124 * Transforms input XML document fragment using given DOMDocumentFragment
125 * and stylesheet and writes output to a CLOB
126 */
127 PROCEDURE processXSL(p Processor, ss Stylesheet,
128 xmldf dbms_xmldom.DOMDocumentFragment, cl in out clob);
129
130 /**
131 * Sets errors to be sent to the specified file
132 */
133 PROCEDURE setErrorLog(p Processor, fileName VARCHAR2);
134
135 /**
136 * Sets warnings TRUE - on, FALSE - off
137 */
138 PROCEDURE showWarnings(p Processor, yes BOOLEAN);
139
140 /**
141 * Create a new stylesheet using the given DOMDocument and base directory URL
142 */
143 FUNCTION newStylesheet(xmldoc dbms_xmldom.DOMDocument, refurl varchar2)
144 return Stylesheet;
145
146 /**
147 * Create a new stylesheet using the given input file and base directory URLs
148 */
149 FUNCTION newStylesheet(inp varchar2, refurl varchar2) return Stylesheet;
150
151 PROCEDURE freeStylesheet(ss Stylesheet);
152
153 /**
154 * Sets the value of a top-level stylesheet parameter.
155 * The parameter value is expected to be a valid XPath expression (note
156 * that string literal values would therefore have to be explicitly quoted).
157 */
158 PROCEDURE setParam(ss Stylesheet, name VARCHAR2, val VARCHAR2);
159
160 /**
161 * Remove a top-level stylesheet parameter.
162 */
163 PROCEDURE removeParam(ss Stylesheet, name VARCHAR2);
164
165 /**
166 * Resets the top-level stylesheet parameters.
167 */
168 PROCEDURE resetParams(ss Stylesheet);
169
170 /**
171 * Transforms a node in the tree using the given stylesheet
172 */
173 FUNCTION transformNode(n dbms_xmldom.DOMNode, ss Stylesheet)
174 return dbms_xmldom.DOMDocumentFragment;
175
176 /**
177 * Selects nodes from the tree which match the given pattern
178 */
179 FUNCTION selectNodes(n dbms_xmldom.DOMNode, pattern VARCHAR2,
180 namespace IN VARCHAR2 := NULL)
181 return dbms_xmldom.DOMNodeList;
182
183 /**
184 * Selects the first node from the tree that matches the given pattern
185 */
186 FUNCTION selectSingleNode(n dbms_xmldom.DOMNode, pattern varchar2,
187 namespace IN VARCHAR2 := NULL)
188 return dbms_xmldom.DOMNode;
189
190 /**
191 * Retrieves the value of the first node from the tree that matches the given
192 * pattern
193 */
194 PROCEDURE valueOf(n dbms_xmldom.DOMNode, pattern VARCHAR2, val OUT VARCHAR2,
195 namespace IN VARCHAR2 := NULL);
196 FUNCTION valueOf(n xmldom.DOMNode, pattern varchar2,
197 namespace IN VARCHAR2 := NULL) return VARCHAR2 ;
198 end dbms_xslprocessor;