libxslt-ruby 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
- #ifndef __RUBY_EXSLT__
2
- #define __RUBY_EXSLT__
3
-
4
- #include <libxslt/extensions.h>
5
-
6
- void ruby_init_exslt(void);
7
-
8
- #endif
1
+ #ifndef __RUBY_EXSLT__
2
+ #define __RUBY_EXSLT__
3
+
4
+ #include <libxslt/extensions.h>
5
+
6
+ void ruby_init_exslt(void);
7
+
8
+ #endif
@@ -1,302 +1,302 @@
1
- /* $Id: ruby_xslt_stylesheet.c 42 2007-12-07 06:09:35Z transami $ */
2
-
3
- /* See the LICENSE file for copyright and distribution information. */
4
-
5
- #include "libxslt.h"
6
- /*
7
- * Document-class: LibXSLT::XSLT::Stylesheet
8
- *
9
- * The XSLT::Stylesheet represents a XSL stylesheet that
10
- * can be used to transform an XML document. For usage information
11
- * refer to XSLT::Stylesheet#apply
12
- *
13
- */
14
-
15
- VALUE cXSLTStylesheet;
16
-
17
- void
18
- ruby_xslt_stylesheet_free(xsltStylesheetPtr xstylesheet) {
19
- xsltFreeStylesheet(xstylesheet);
20
- }
21
-
22
- static VALUE
23
- ruby_xslt_stylesheet_alloc(VALUE klass) {
24
- return Data_Wrap_Struct(cXSLTStylesheet,
25
- NULL, ruby_xslt_stylesheet_free,
26
- NULL);
27
- }
28
-
29
-
30
- /* call-seq:
31
- * XSLT::Stylesheet.new(document) -> XSLT::Stylesheet
32
- *
33
- * Creates a new XSLT stylesheet based on the specified document.
34
- * For memory management reasons, a copy of the specified document
35
- * will be made, so its best to create a single copy of a stylesheet
36
- * and use it multiple times.
37
- *
38
- * stylesheet_doc = XML::Document.file('stylesheet_file')
39
- * stylesheet = XSLT::Stylesheet.new(stylesheet_doc)
40
- *
41
- */
42
- static VALUE
43
- ruby_xslt_stylesheet_initialize(VALUE self, VALUE document) {
44
- xmlDocPtr xdoc;
45
- xmlDocPtr xcopy;
46
- xsltStylesheetPtr xstylesheet;
47
-
48
- if (!rb_obj_is_kind_of(document, cXMLDocument))
49
- rb_raise(rb_eTypeError, "Must pass in an XML::Document instance.");
50
-
51
- /* NOTE!! Since the stylesheet own the specified document, the easiest
52
- * thing to do from a memory standpoint is too copy it and not expose
53
- * the copy to Ruby. The other solution is expose a memory management
54
- * API on the document object for taking ownership of the document
55
- * and specifying when it has been freed. Then the document class
56
- * has to be updated to always check and see if the document is
57
- * still valid. That's all doable, but seems like a pain, so
58
- * just copy the document for now. */
59
- Data_Get_Struct(document, xmlDoc, xdoc);
60
- xcopy = xmlCopyDoc(xdoc, 1);
61
- xstylesheet = xsltParseStylesheetDoc(xcopy);
62
- xstylesheet->_private = (void *)self;
63
- DATA_PTR(self) = xstylesheet;
64
-
65
- /* Save a reference to the document as an attribute accessable to ruby */
66
- return self;
67
- }
68
-
69
- /* Helper method to convert Ruby params to C params */
70
- char **
71
- ruby_xslt_coerce_params(VALUE params) {
72
- char** result;
73
- size_t length;
74
- size_t i;
75
-
76
- length = RARRAY_LEN(params);
77
- result = ALLOC_N(char *, length + 2);
78
-
79
- for (i=0; i<length; i++) {
80
- VALUE str = rb_String(RARRAY_PTR(params)[i]);
81
- int strLen = RSTRING_LEN(str);
82
- result[i] = ALLOC_N(char, strLen + 1);
83
- memset(result[i], 0, strLen + 1);
84
- strncpy(result[i], RSTRING_PTR(str), strLen);
85
- }
86
-
87
- /* Null terminate the array - need to empty elements */
88
- result[i] = NULL;
89
- result[i+1] = NULL;
90
-
91
- return result;
92
- }
93
-
94
- /* call-seq:
95
- * stylesheet.apply(document, {params}) -> XML::Document
96
- *
97
- * Apply this stylesheet transformation to the provided document.
98
- * This method may be invoked multiple times.
99
- *
100
- * Params:
101
- * * document - An instance of an XML::Document
102
- * * params - An optional hash table that specifies the values for xsl:param values embedded in the stylesheet.
103
- *
104
- * Example:
105
- *
106
- * stylesheet_doc = XML::Document.file('stylesheet_file')
107
- * stylesheet = XSLT::Stylesheet.new(stylesheet_doc)
108
- *
109
- * xml_doc = XML::Document.file('xml_file')
110
- * result = stylesheet.apply(xml_doc)
111
- * result = stylesheet.apply(xml_doc, {:foo => 'bar'})
112
- */
113
- static VALUE
114
- ruby_xslt_stylesheet_apply(int argc, VALUE *argv, VALUE self) {
115
- xmlDocPtr xdoc;
116
- xsltStylesheetPtr xstylesheet;
117
- xmlDocPtr result;
118
- VALUE document;
119
- VALUE params;
120
- int i;
121
-
122
- char** pParams;
123
-
124
- if (argc > 2 || argc < 1)
125
- rb_raise(rb_eArgError, "wrong number of arguments (need 1 or 2)");
126
-
127
- document = argv[0];
128
-
129
- if (!rb_obj_is_kind_of(document, cXMLDocument))
130
- rb_raise(rb_eTypeError, "Must pass in an XML::Document instance.");
131
-
132
- /* Make sure params is a flat array */
133
- params = (argc == 2 ? argv[1]: Qnil);
134
- params = rb_Array(params);
135
- rb_funcall(params, rb_intern("flatten!"), 0);
136
- pParams = ruby_xslt_coerce_params(params);
137
-
138
- Data_Get_Struct(document, xmlDoc, xdoc);
139
- Data_Get_Struct(self, xsltStylesheet, xstylesheet);
140
-
141
- result = xsltApplyStylesheet(xstylesheet, xdoc, (const char**)pParams);
142
-
143
- if (!result)
144
- rb_raise(eXSLTError, "Transformation failed");
145
-
146
- /* Free allocated array of *chars. Note we don't have to
147
- free the last array item since its set to NULL. */
148
- for (i=0; i<RARRAY_LEN(params); i++) {
149
- ruby_xfree(pParams[i]);
150
- }
151
- ruby_xfree(pParams);
152
-
153
- return rxml_document_wrap(result);
154
- }
155
-
156
-
157
- /* call-seq:
158
- * sheet.debug(to = $stdout) => (true|false)
159
- *
160
- * Output a debug dump of this stylesheet to the specified output
161
- * stream (an instance of IO, defaults to $stdout). Requires
162
- * libxml/libxslt be compiled with debugging enabled. If this
163
- * is not the case, a warning is triggered and the method returns
164
- * false.
165
- */
166
- /*VALUE
167
- ruby_xslt_stylesheet_debug(int argc, VALUE *argv, VALUE self) {
168
- #ifdef LIBXML_DEBUG_ENABLED
169
- OpenFile *fptr;
170
- VALUE io;
171
- FILE *out;
172
- rxml_document_t *parsed;
173
- ruby_xslt_stylesheet *xss;
174
-
175
- Data_Get_Struct(self, ruby_xslt_stylesheet, xss);
176
- if (NIL_P(xss->parsed))
177
- rb_raise(eXMLXSLTStylesheetRequireParsedDoc, "must have a parsed XML result");
178
-
179
- switch (argc) {
180
- case 0:
181
- io = rb_stdout;
182
- break;
183
- case 1:
184
- io = argv[0];
185
- if (rb_obj_is_kind_of(io, rb_cIO) == Qfalse)
186
- rb_raise(rb_eTypeError, "need an IO object");
187
- break;
188
- default:
189
- rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
190
- }
191
-
192
- Data_Get_Struct(xss->parsed, rxml_document_t, parsed);
193
- if (parsed->doc == NULL)
194
- return(Qnil);
195
-
196
- GetOpenFile(io, fptr);
197
- rb_io_check_writable(fptr);
198
- out = GetWriteFile(fptr);
199
- xmlDebugDumpDocument(out, parsed->doc);
200
- return(Qtrue);
201
- #else
202
- rb_warn("libxml/libxslt was compiled without debugging support. Please recompile libxml/libxslt and their Ruby modules");
203
- return(Qfalse);
204
- #endif
205
- }
206
- */
207
-
208
- /* TODO should this automatically apply the sheet if not already,
209
- given that we're unlikely to do much else with it? */
210
-
211
- /* call-seq:
212
- * sheet.print(to = $stdout) => number_of_bytes
213
- *
214
- * Output the result of the transform to the specified output
215
- * stream (an IO instance, defaults to $stdout). You *must* call
216
- * +apply+ before this method or an exception will be raised.
217
- */
218
- /*VALUE
219
- ruby_xslt_stylesheet_print(int argc, VALUE *argv, VALUE self) {
220
- OpenFile *fptr;
221
- VALUE io;
222
- FILE *out;
223
- rxml_document_t *parsed;
224
- ruby_xslt_stylesheet *xss;
225
- int bytes;
226
-
227
- Data_Get_Struct(self, ruby_xslt_stylesheet, xss);
228
- if (NIL_P(xss->parsed))
229
- rb_raise(eXMLXSLTStylesheetRequireParsedDoc, "must have a parsed XML result");
230
-
231
- switch (argc) {
232
- case 0:
233
- io = rb_stdout;
234
- break;
235
- case 1:
236
- io = argv[0];
237
- if (rb_obj_is_kind_of(io, rb_cIO) == Qfalse)
238
- rb_raise(rb_eTypeError, "need an IO object");
239
- break;
240
- default:
241
- rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
242
- }
243
-
244
- Data_Get_Struct(xss->parsed, rxml_document_t, parsed);
245
- if (parsed->doc == NULL)
246
- return(Qnil);
247
-
248
- GetOpenFile(io, fptr);
249
- rb_io_check_writable(fptr);
250
- out = GetWriteFile(fptr);
251
- bytes = xsltSaveResultToFile(out, parsed->doc, xss->xsp);
252
-
253
- return(INT2NUM(bytes));
254
- }*/
255
-
256
- /* call-seq:
257
- * stylesheet.output(doc) => string
258
- *
259
- * Output an xml document, usually the result of an xslt
260
- * transformation, and return the result as a string. Output will be
261
- * done according to the output specification in the xslt
262
- * stylesheet. Note that this includes the encoding of the string.
263
- */
264
- VALUE
265
- ruby_xslt_stylesheet_output(VALUE self, VALUE document) {
266
- // FIXME: set string encoding in ruby 1.9?
267
- xmlDocPtr xdoc;
268
- xsltStylesheetPtr xstylesheet;
269
- xmlChar *result = NULL;
270
- int len = 0, bytes = 0;
271
- VALUE rresult;
272
-
273
- if (!rb_obj_is_kind_of(document, cXMLDocument))
274
- rb_raise(rb_eTypeError, "Must pass in an XML::Document instance.");
275
-
276
- Data_Get_Struct(document, xmlDoc, xdoc);
277
- Data_Get_Struct(self, xsltStylesheet, xstylesheet);
278
-
279
- bytes = xsltSaveResultToString(&result, &len,
280
- xdoc, xstylesheet);
281
- if ( bytes == -1 ) {
282
- rb_raise(rb_eRuntimeError, "error dumping document");
283
- }
284
-
285
- rresult=rb_str_new((const char*)result,len);
286
- xmlFree(result);
287
- return rresult;
288
- }
289
-
290
- #ifdef RDOC_NEVER_DEFINED
291
- cLibXSLT = rb_define_module("LibXSLT");
292
- cXSLT = rb_define_module_under(cLibXSLT, "XSLT");
293
- #endif
294
-
295
- void
296
- ruby_init_xslt_stylesheet(void) {
297
- cXSLTStylesheet = rb_define_class_under(cXSLT, "Stylesheet", rb_cObject);
298
- rb_define_alloc_func(cXSLTStylesheet, ruby_xslt_stylesheet_alloc);
299
- rb_define_method(cXSLTStylesheet, "initialize", ruby_xslt_stylesheet_initialize, 1);
300
- rb_define_method(cXSLTStylesheet, "apply", ruby_xslt_stylesheet_apply, -1);
301
- rb_define_method(cXSLTStylesheet, "output", ruby_xslt_stylesheet_output, 1);
302
- }
1
+ /* $Id: ruby_xslt_stylesheet.c 42 2007-12-07 06:09:35Z transami $ */
2
+
3
+ /* See the LICENSE file for copyright and distribution information. */
4
+
5
+ #include "libxslt.h"
6
+ /*
7
+ * Document-class: LibXSLT::XSLT::Stylesheet
8
+ *
9
+ * The XSLT::Stylesheet represents a XSL stylesheet that
10
+ * can be used to transform an XML document. For usage information
11
+ * refer to XSLT::Stylesheet#apply
12
+ *
13
+ */
14
+
15
+ VALUE cXSLTStylesheet;
16
+
17
+ void
18
+ ruby_xslt_stylesheet_free(xsltStylesheetPtr xstylesheet) {
19
+ xsltFreeStylesheet(xstylesheet);
20
+ }
21
+
22
+ static VALUE
23
+ ruby_xslt_stylesheet_alloc(VALUE klass) {
24
+ return Data_Wrap_Struct(cXSLTStylesheet,
25
+ NULL, ruby_xslt_stylesheet_free,
26
+ NULL);
27
+ }
28
+
29
+
30
+ /* call-seq:
31
+ * XSLT::Stylesheet.new(document) -> XSLT::Stylesheet
32
+ *
33
+ * Creates a new XSLT stylesheet based on the specified document.
34
+ * For memory management reasons, a copy of the specified document
35
+ * will be made, so its best to create a single copy of a stylesheet
36
+ * and use it multiple times.
37
+ *
38
+ * stylesheet_doc = XML::Document.file('stylesheet_file')
39
+ * stylesheet = XSLT::Stylesheet.new(stylesheet_doc)
40
+ *
41
+ */
42
+ static VALUE
43
+ ruby_xslt_stylesheet_initialize(VALUE self, VALUE document) {
44
+ xmlDocPtr xdoc;
45
+ xmlDocPtr xcopy;
46
+ xsltStylesheetPtr xstylesheet;
47
+
48
+ if (!rb_obj_is_kind_of(document, cXMLDocument))
49
+ rb_raise(rb_eTypeError, "Must pass in an XML::Document instance.");
50
+
51
+ /* NOTE!! Since the stylesheet own the specified document, the easiest
52
+ * thing to do from a memory standpoint is too copy it and not expose
53
+ * the copy to Ruby. The other solution is expose a memory management
54
+ * API on the document object for taking ownership of the document
55
+ * and specifying when it has been freed. Then the document class
56
+ * has to be updated to always check and see if the document is
57
+ * still valid. That's all doable, but seems like a pain, so
58
+ * just copy the document for now. */
59
+ Data_Get_Struct(document, xmlDoc, xdoc);
60
+ xcopy = xmlCopyDoc(xdoc, 1);
61
+ xstylesheet = xsltParseStylesheetDoc(xcopy);
62
+ xstylesheet->_private = (void *)self;
63
+ DATA_PTR(self) = xstylesheet;
64
+
65
+ /* Save a reference to the document as an attribute accessable to ruby */
66
+ return self;
67
+ }
68
+
69
+ /* Helper method to convert Ruby params to C params */
70
+ char **
71
+ ruby_xslt_coerce_params(VALUE params) {
72
+ char** result;
73
+ size_t length;
74
+ size_t i;
75
+
76
+ length = RARRAY_LEN(params);
77
+ result = ALLOC_N(char *, length + 2);
78
+
79
+ for (i=0; i<length; i++) {
80
+ VALUE str = rb_String(RARRAY_PTR(params)[i]);
81
+ int strLen = RSTRING_LEN(str);
82
+ result[i] = ALLOC_N(char, strLen + 1);
83
+ memset(result[i], 0, strLen + 1);
84
+ strncpy(result[i], RSTRING_PTR(str), strLen);
85
+ }
86
+
87
+ /* Null terminate the array - need to empty elements */
88
+ result[i] = NULL;
89
+ result[i+1] = NULL;
90
+
91
+ return result;
92
+ }
93
+
94
+ /* call-seq:
95
+ * stylesheet.apply(document, {params}) -> XML::Document
96
+ *
97
+ * Apply this stylesheet transformation to the provided document.
98
+ * This method may be invoked multiple times.
99
+ *
100
+ * Params:
101
+ * * document - An instance of an XML::Document
102
+ * * params - An optional hash table that specifies the values for xsl:param values embedded in the stylesheet.
103
+ *
104
+ * Example:
105
+ *
106
+ * stylesheet_doc = XML::Document.file('stylesheet_file')
107
+ * stylesheet = XSLT::Stylesheet.new(stylesheet_doc)
108
+ *
109
+ * xml_doc = XML::Document.file('xml_file')
110
+ * result = stylesheet.apply(xml_doc)
111
+ * result = stylesheet.apply(xml_doc, {:foo => 'bar'})
112
+ */
113
+ static VALUE
114
+ ruby_xslt_stylesheet_apply(int argc, VALUE *argv, VALUE self) {
115
+ xmlDocPtr xdoc;
116
+ xsltStylesheetPtr xstylesheet;
117
+ xmlDocPtr result;
118
+ VALUE document;
119
+ VALUE params;
120
+ int i;
121
+
122
+ char** pParams;
123
+
124
+ if (argc > 2 || argc < 1)
125
+ rb_raise(rb_eArgError, "wrong number of arguments (need 1 or 2)");
126
+
127
+ document = argv[0];
128
+
129
+ if (!rb_obj_is_kind_of(document, cXMLDocument))
130
+ rb_raise(rb_eTypeError, "Must pass in an XML::Document instance.");
131
+
132
+ /* Make sure params is a flat array */
133
+ params = (argc == 2 ? argv[1]: Qnil);
134
+ params = rb_Array(params);
135
+ rb_funcall(params, rb_intern("flatten!"), 0);
136
+ pParams = ruby_xslt_coerce_params(params);
137
+
138
+ Data_Get_Struct(document, xmlDoc, xdoc);
139
+ Data_Get_Struct(self, xsltStylesheet, xstylesheet);
140
+
141
+ result = xsltApplyStylesheet(xstylesheet, xdoc, (const char**)pParams);
142
+
143
+ if (!result)
144
+ rb_raise(eXSLTError, "Transformation failed");
145
+
146
+ /* Free allocated array of *chars. Note we don't have to
147
+ free the last array item since its set to NULL. */
148
+ for (i=0; i<RARRAY_LEN(params); i++) {
149
+ ruby_xfree(pParams[i]);
150
+ }
151
+ ruby_xfree(pParams);
152
+
153
+ return rxml_document_wrap(result);
154
+ }
155
+
156
+
157
+ /* call-seq:
158
+ * sheet.debug(to = $stdout) => (true|false)
159
+ *
160
+ * Output a debug dump of this stylesheet to the specified output
161
+ * stream (an instance of IO, defaults to $stdout). Requires
162
+ * libxml/libxslt be compiled with debugging enabled. If this
163
+ * is not the case, a warning is triggered and the method returns
164
+ * false.
165
+ */
166
+ /*VALUE
167
+ ruby_xslt_stylesheet_debug(int argc, VALUE *argv, VALUE self) {
168
+ #ifdef LIBXML_DEBUG_ENABLED
169
+ OpenFile *fptr;
170
+ VALUE io;
171
+ FILE *out;
172
+ rxml_document_t *parsed;
173
+ ruby_xslt_stylesheet *xss;
174
+
175
+ Data_Get_Struct(self, ruby_xslt_stylesheet, xss);
176
+ if (NIL_P(xss->parsed))
177
+ rb_raise(eXMLXSLTStylesheetRequireParsedDoc, "must have a parsed XML result");
178
+
179
+ switch (argc) {
180
+ case 0:
181
+ io = rb_stdout;
182
+ break;
183
+ case 1:
184
+ io = argv[0];
185
+ if (rb_obj_is_kind_of(io, rb_cIO) == Qfalse)
186
+ rb_raise(rb_eTypeError, "need an IO object");
187
+ break;
188
+ default:
189
+ rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
190
+ }
191
+
192
+ Data_Get_Struct(xss->parsed, rxml_document_t, parsed);
193
+ if (parsed->doc == NULL)
194
+ return(Qnil);
195
+
196
+ GetOpenFile(io, fptr);
197
+ rb_io_check_writable(fptr);
198
+ out = GetWriteFile(fptr);
199
+ xmlDebugDumpDocument(out, parsed->doc);
200
+ return(Qtrue);
201
+ #else
202
+ rb_warn("libxml/libxslt was compiled without debugging support. Please recompile libxml/libxslt and their Ruby modules");
203
+ return(Qfalse);
204
+ #endif
205
+ }
206
+ */
207
+
208
+ /* TODO should this automatically apply the sheet if not already,
209
+ given that we're unlikely to do much else with it? */
210
+
211
+ /* call-seq:
212
+ * sheet.print(to = $stdout) => number_of_bytes
213
+ *
214
+ * Output the result of the transform to the specified output
215
+ * stream (an IO instance, defaults to $stdout). You *must* call
216
+ * +apply+ before this method or an exception will be raised.
217
+ */
218
+ /*VALUE
219
+ ruby_xslt_stylesheet_print(int argc, VALUE *argv, VALUE self) {
220
+ OpenFile *fptr;
221
+ VALUE io;
222
+ FILE *out;
223
+ rxml_document_t *parsed;
224
+ ruby_xslt_stylesheet *xss;
225
+ int bytes;
226
+
227
+ Data_Get_Struct(self, ruby_xslt_stylesheet, xss);
228
+ if (NIL_P(xss->parsed))
229
+ rb_raise(eXMLXSLTStylesheetRequireParsedDoc, "must have a parsed XML result");
230
+
231
+ switch (argc) {
232
+ case 0:
233
+ io = rb_stdout;
234
+ break;
235
+ case 1:
236
+ io = argv[0];
237
+ if (rb_obj_is_kind_of(io, rb_cIO) == Qfalse)
238
+ rb_raise(rb_eTypeError, "need an IO object");
239
+ break;
240
+ default:
241
+ rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
242
+ }
243
+
244
+ Data_Get_Struct(xss->parsed, rxml_document_t, parsed);
245
+ if (parsed->doc == NULL)
246
+ return(Qnil);
247
+
248
+ GetOpenFile(io, fptr);
249
+ rb_io_check_writable(fptr);
250
+ out = GetWriteFile(fptr);
251
+ bytes = xsltSaveResultToFile(out, parsed->doc, xss->xsp);
252
+
253
+ return(INT2NUM(bytes));
254
+ }*/
255
+
256
+ /* call-seq:
257
+ * stylesheet.output(doc) => string
258
+ *
259
+ * Output an xml document, usually the result of an xslt
260
+ * transformation, and return the result as a string. Output will be
261
+ * done according to the output specification in the xslt
262
+ * stylesheet. Note that this includes the encoding of the string.
263
+ */
264
+ VALUE
265
+ ruby_xslt_stylesheet_output(VALUE self, VALUE document) {
266
+ // FIXME: set string encoding in ruby 1.9?
267
+ xmlDocPtr xdoc;
268
+ xsltStylesheetPtr xstylesheet;
269
+ xmlChar *result = NULL;
270
+ int len = 0, bytes = 0;
271
+ VALUE rresult;
272
+
273
+ if (!rb_obj_is_kind_of(document, cXMLDocument))
274
+ rb_raise(rb_eTypeError, "Must pass in an XML::Document instance.");
275
+
276
+ Data_Get_Struct(document, xmlDoc, xdoc);
277
+ Data_Get_Struct(self, xsltStylesheet, xstylesheet);
278
+
279
+ bytes = xsltSaveResultToString(&result, &len,
280
+ xdoc, xstylesheet);
281
+ if ( bytes == -1 ) {
282
+ rb_raise(rb_eRuntimeError, "error dumping document");
283
+ }
284
+
285
+ rresult=rb_str_new((const char*)result,len);
286
+ xmlFree(result);
287
+ return rresult;
288
+ }
289
+
290
+ #ifdef RDOC_NEVER_DEFINED
291
+ cLibXSLT = rb_define_module("LibXSLT");
292
+ cXSLT = rb_define_module_under(cLibXSLT, "XSLT");
293
+ #endif
294
+
295
+ void
296
+ ruby_init_xslt_stylesheet(void) {
297
+ cXSLTStylesheet = rb_define_class_under(cXSLT, "Stylesheet", rb_cObject);
298
+ rb_define_alloc_func(cXSLTStylesheet, ruby_xslt_stylesheet_alloc);
299
+ rb_define_method(cXSLTStylesheet, "initialize", ruby_xslt_stylesheet_initialize, 1);
300
+ rb_define_method(cXSLTStylesheet, "apply", ruby_xslt_stylesheet_apply, -1);
301
+ rb_define_method(cXSLTStylesheet, "output", ruby_xslt_stylesheet_output, 1);
302
+ }