Project

Profile

Help

How to connect?
Download (49.1 KB) Statistics
| Branch: | Revision:

he / src / main / c / Saxon.C.API / XsltExecutable.cpp @ 4ee4355d

1
// XsltExecutable.cpp : Defines the exported functions for the DLL application.
2
//
3

    
4
#include "XsltExecutable.h"
5
#include "XdmValue.h"
6
#include "XdmItem.h"
7
#include "XdmNode.h"
8
#include "XdmFunctionItem.h"
9
#include "XdmMap.h"
10
#include "XdmArray.h"
11
#include "XdmAtomicValue.h"
12

    
13
#ifdef DEBUG
14
#include <typeinfo> //used for testing only
15
#endif
16

    
17

    
18
XsltExecutable::XsltExecutable(jobject exObject, std::string curr) {
19

    
20

    
21

    
22
    /*
23
     * Look for class.
24
     */
25
    cppClass = lookForClass(SaxonProcessor::sxn_environ->env,
26
                            "net/sf/saxon/option/cpp/Xslt30Processor");
27

    
28
    messageListenerClass = lookForClass(SaxonProcessor::sxn_environ->env,
29
                                               "net/sf/saxon/option/cpp/SaxonCMessageListener");
30

    
31
#ifdef DEBUG
32
    jmethodID debugMID = SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass, "setDebugMode", "(Z)V");
33
    SaxonProcessor::sxn_environ->env->CallStaticVoidMethod(cppClass, debugMID, (jboolean)true);
34

    
35
#endif
36
    tunnel = false;
37
    selection = nullptr;
38
    selectionV = nullptr;
39
    saxonMessageListenerObj = nullptr;
40
    executableObject = exObject;
41
    cwdXE = curr;
42
}
43

    
44
XsltExecutable::~XsltExecutable() {
45
    clearProperties();
46
    clearParameters();
47

    
48
    if(selection) {
49
        SaxonProcessor::sxn_environ->env->DeleteGlobalRef(selection);
50
        selection = nullptr;
51
    }
52
    SaxonProcessor::sxn_environ->env->DeleteGlobalRef(executableObject);
53
    SaxonProcessor::sxn_environ->env->ExceptionClear(); // This is as a precaution to avoid crashing out if JNI gets into an unclean state.
54
}
55

    
56

    
57
XsltExecutable::XsltExecutable(const XsltExecutable &other) {
58

    
59
    /*
60
     * Look for class.
61
     */
62
    cppClass = lookForClass(SaxonProcessor::sxn_environ->env,
63
                            "net/sf/saxon/option/cpp/Xslt30Processor");
64

    
65
    executableObject = other.executableObject;
66
    selectionV = other.selectionV;
67
    if (selectionV != nullptr) {
68
        setInitialMatchSelection(other.selectionV);
69
    } else {
70
        selection = other.selection;
71
    }
72
    tunnel = other.tunnel;
73

    
74
    std::map<std::string, XdmValue *>::const_iterator paramIter = other.parameters.begin();
75
    while (paramIter != other.parameters.end()) {
76

    
77
        XdmValue *valuei = paramIter->second;
78
        if (valuei == nullptr) {
79
            std::cerr << "Error in XsltExecutable copy constructor - parameter value is NULL" << std::endl;
80
        } else {
81
            parameters[paramIter->first] = new XdmValue(*(valuei));
82
        }
83
        paramIter++;
84
    }
85

    
86
    std::map<std::string, std::string>::const_iterator propIter = other.properties.begin();
87
    while (propIter != other.properties.end()) {
88
        properties[propIter->first] = propIter->second;
89
        propIter++;
90
    }
91

    
92
}
93

    
94

    
95
bool XsltExecutable::exceptionOccurred() {
96
    return SaxonProcessor::sxn_environ->env->ExceptionCheck();
97
}
98

    
99

    
100
void XsltExecutable::setGlobalContextItem(XdmItem *value) {
101
    if (value != nullptr) {
102
        value->incrementRefCount();
103
        parameters["node"] = value;
104
    }
105
}
106

    
107
void XsltExecutable::setGlobalContextFromFile(const char *ifile) {
108
    if (ifile != nullptr) {
109
        setProperty("s", ifile);
110
    }
111
}
112

    
113
void XsltExecutable::setInitialMatchSelection(XdmValue *_selection) {
114
    if (_selection != nullptr) {
115
        _selection->incrementRefCount();
116
        selectionV = _selection;
117
        selection = SaxonProcessor::sxn_environ->env->NewGlobalRef(_selection->getUnderlyingValue());
118
    }
119
}
120

    
121

    
122
void XsltExecutable::setInitialMatchSelectionAsFile(const char *filename) {
123
    if (filename != nullptr) {
124
        selection = SaxonProcessor::sxn_environ->env->NewGlobalRef(SaxonProcessor::sxn_environ->env->NewStringUTF(filename));
125

    
126
    }
127
}
128

    
129
void XsltExecutable::setOutputFile(const char *ofile) {
130
    setProperty("o", ofile);
131
}
132

    
133
void XsltExecutable::setBaseOutputURI(const char *baseURI) {
134
    if (baseURI != nullptr) {
135
        setProperty("baseoutput", baseURI);
136
    }
137
}
138

    
139

    
140
void XsltExecutable::setParameter(const char *name, XdmValue *value) {
141
    if (value != nullptr && name != nullptr) {
142
        value->incrementRefCount();
143
        int s = parameters.size();
144
        std::string skey = "param:" + std::string(name);
145
        parameters[skey] = value;
146
        if (s == parameters.size()) {
147
            std::map<std::string, XdmValue *>::iterator it;
148
            it = parameters.find(skey);
149
            if (it != parameters.end()) {
150
                XdmValue *valuei = it->second;
151
                if(valuei != nullptr) {
152
                    valuei->decrementRefCount();
153
                    parameters.erase(skey);
154
                    parameters[skey] = value;
155
                }
156
            }
157
        }
158
    }
159
}
160

    
161
void XsltExecutable::setInitialTemplateParameters(std::map<std::string, XdmValue *> _itparameters, bool _tunnel) {
162
    for (std::map<std::string, XdmValue *>::iterator itr = _itparameters.begin(); itr != _itparameters.end(); itr++) {
163
        parameters["itparam:" + std::string(itr->first)] = itr->second;
164
        itr->second->incrementRefCount();
165
    }
166
    tunnel = _tunnel;
167
    if (tunnel) {
168
        setProperty("tunnel", "true");
169
    }
170
}
171

    
172
XdmValue *XsltExecutable::getParameter(const char *name) {
173
    std::map<std::string, XdmValue *>::iterator it;
174
    it = parameters.find("param:" + std::string(name));
175
    if (it != parameters.end())
176
        return it->second;
177
    else {
178
        it = parameters.find("sparam:" + std::string(name));
179
        if (it != parameters.end())
180
            return it->second;
181
    }
182
    return nullptr;
183
}
184

    
185
bool XsltExecutable::removeParameter(const char *name) {
186
    return (bool) (parameters.erase("param:" + std::string(name)));
187
}
188

    
189

    
190
void XsltExecutable::setResultAsRawValue(bool option) {
191
    if (option) {
192
        setProperty("outvalue", "yes");
193
    }
194
}
195

    
196
XsltExecutable * XsltExecutable::clone() {
197
    XsltExecutable * executable = new XsltExecutable(*this);
198
    return executable;
199

    
200
}
201

    
202
void XsltExecutable::setProperty(const char *name, const char *value) {
203
    if (name != nullptr) {
204
        int s = properties.size();
205

    
206
        std::string skey = std::string(name);
207
        properties.insert(std::pair<std::string, std::string>(skey, std::string((value == nullptr ? "" : value))));
208

    
209
        if (s == properties.size()) {
210
            std::map<std::string, std::string>::iterator it;
211
            it = properties.find(skey);
212
            if (it != properties.end()) {
213
                properties.erase(skey);
214
                properties[skey] = std::string((value == nullptr ? "" : value));
215
            }
216
        }
217
    }
218
}
219

    
220
const char *XsltExecutable::getProperty(const char *name) {
221
    std::map<std::string, std::string>::iterator it;
222
    it = properties.find(std::string(name));
223
    if (it != properties.end())
224
        return it->second.c_str();
225
    return nullptr;
226
}
227

    
228
void XsltExecutable::clearParameters(bool delValues) {
229
    if (delValues) {
230
        for (std::map<std::string, XdmValue *>::iterator itr = parameters.begin(); itr != parameters.end(); itr++) {
231

    
232
            XdmValue *value = itr->second;
233
            if(value != nullptr) {
234
#ifdef DEBUG
235
                std::cout<<"clearParameter() - XdmValue refCount="<<value->getRefCount()<<std::endl;
236
#endif
237
                    delete value;
238
            }
239
        }
240
    }
241
    parameters.clear();
242
}
243

    
244
void XsltExecutable::clearProperties() {
245
    properties.clear();
246

    
247
}
248

    
249

    
250
std::map<std::string, XdmValue *> &XsltExecutable::getParameters() {
251
    std::map<std::string, XdmValue *> &ptr = parameters;
252
    return ptr;
253
}
254

    
255
std::map<std::string, std::string> &XsltExecutable::getProperties() {
256
    std::map<std::string, std::string> &ptr = properties;
257
    return ptr;
258
}
259

    
260
void XsltExecutable::exceptionClear() {
261
    SaxonProcessor::sxn_environ->env->ExceptionClear();
262
}
263

    
264
void XsltExecutable::setcwd(const char *dir) {
265
    if (dir != nullptr) {
266
        cwdXE = std::string(dir);
267
    }
268
}
269

    
270

    
271
void XsltExecutable::exportStylesheet(const char *filename) {
272

    
273

    
274
    static jmethodID exportmID = nullptr;
275

    
276
    if (!exportmID) {
277
        exportmID = SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass, "save",
278
                                                                        "(Ljava/lang/String;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;)V");
279
    }
280

    
281
    if (filename == nullptr) {
282
        std::cerr << "Error: Error: export file name is nullptr" << std::endl;
283
        return;
284
    }
285
    SaxonProcessor::sxn_environ->env->CallStaticVoidMethod(cppClass, exportmID,
286
                                                           SaxonProcessor::sxn_environ->env->NewStringUTF(
287
                                                                   cwdXE.c_str()),
288
                                                           executableObject,
289
                                                           SaxonProcessor::sxn_environ->env->NewStringUTF(filename));
290

    
291
}
292

    
293
void XsltExecutable::applyTemplatesReturningFile(const char *output_filename) {
294

    
295
    if (selection == nullptr) {
296
        std::cerr
297
                << "Error: The initial match selection has not been set. Please set it using setInitialMatchSelection or setInitialMatchSelectionFile."
298
                << std::endl;
299
        return;
300
    }
301

    
302
    static jmethodID atmID = nullptr;
303

    
304
    if (atmID == nullptr) {
305
        atmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
306
                                                                        "applyTemplatesReturningFile",
307
                                                                        "(Ljava/lang/String;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)V");
308
    }
309

    
310
    if (!atmID) {
311
        std::cerr << "Error: " << getDllname() << ".applyTemplatesReturningFile" << " not found\n"
312
                  << std::endl;
313
        SaxonProcessor::sxn_environ->env->ExceptionClear();
314
    } else {
315
        JParameters comboArrays;
316
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
317
        SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, atmID,
318
                                                                 SaxonProcessor::sxn_environ->env->NewStringUTF(
319
                                                                         cwdXE.c_str()), executableObject, selection,
320
                                                                 (output_filename != nullptr
321
                                                                  ? SaxonProcessor::sxn_environ->env->NewStringUTF(
322
                                                                                 output_filename) : nullptr),
323
                                                                 comboArrays.stringArray, comboArrays.objectArray);
324
        if (comboArrays.stringArray != nullptr) {
325
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
326
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
327
        }
328

    
329
    }
330
    return;
331

    
332
}
333

    
334
const char *XsltExecutable::applyTemplatesReturningString() {
335

    
336
    if (selection == nullptr) {
337
        std::cerr
338
                << "Error: The initial match selection has not been set. Please set it using setInitialMatchSelection or setInitialMatchSelectionFile."
339
                << std::endl;
340
        return nullptr;
341
    }
342

    
343

    
344
    static jmethodID atsmID = nullptr;
345

    
346
    if (atsmID == nullptr) {
347
        atsmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
348
                                                                             "applyTemplatesReturningString",
349
                                                                             "(Ljava/lang/String;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/Object;[Ljava/lang/String;[Ljava/lang/Object;)[B");
350
    }
351
    if (!atsmID) {
352
        std::cerr << "Error: " << getDllname() << "applyTemplatesAsString" << " not found\n"
353
                  << std::endl;
354
        SaxonProcessor::sxn_environ->env->ExceptionClear();
355
    } else {
356
        JParameters comboArrays;
357
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
358

    
359
        jbyteArray result = nullptr;
360
        jobject obj = (SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, atsmID,
361
                                                                                SaxonProcessor::sxn_environ->env->NewStringUTF(
362
                                                                                        cwdXE.c_str()), executableObject,selection,
363
                comboArrays.stringArray, comboArrays.objectArray));
364

    
365
        if (obj) {
366
            result = (jbyteArray) obj;
367
        }
368
        if (comboArrays.stringArray != nullptr) {
369
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
370
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
371
        }
372
        if (result) {
373
            jboolean isCopy = false;
374
            jbyte* b = SaxonProcessor::sxn_environ->env->GetByteArrayElements(result, &isCopy);
375
            jsize num_bytes = SaxonProcessor::sxn_environ->env->GetArrayLength(result);
376

    
377
            const char *str = new char[num_bytes];
378
            memcpy ((void *) str, b , num_bytes );
379

    
380
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(obj);
381
            return str;
382
        }
383
    }
384
    return nullptr;
385

    
386

    
387
}
388

    
389
XdmValue *XsltExecutable::applyTemplatesReturningValue() {
390

    
391
    if (selection == nullptr) {
392
        std::cerr
393
                << "Error: The initial match selection has not been set. Please set it using setInitialMatchSelection or setInitialMatchSelectionFile."
394
                << std::endl;
395
        return nullptr;
396
    }
397

    
398

    
399
    static jmethodID atsvmID = nullptr;
400
    if (atsvmID == nullptr) {
401
        atsvmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
402
                                                                                 "applyTemplatesReturningValue",
403
                                                                                 "(Ljava/lang/String;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/Object;[Ljava/lang/String;[Ljava/lang/Object;)Lnet/sf/saxon/s9api/XdmValue;");
404
    }
405
    if (!atsvmID) {
406
        std::cerr << "Error: " << getDllname() << "applyTemplatesAsValue" << " not found\n"
407
                  << std::endl;
408
        SaxonProcessor::sxn_environ->env->ExceptionClear();
409
    } else {
410
        JParameters comboArrays;
411
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
412

    
413

    
414
        // jstring result = nullptr;
415
        jobject result = (jobject) (SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, atsvmID,
416
                                                                                             SaxonProcessor::sxn_environ->env->NewStringUTF(
417
                                                                                                     cwdXE.c_str()),
418
                                                                                             executableObject,
419
                                                                                             selection,
420
                                                                                             comboArrays.stringArray,
421
                                                                                             comboArrays.objectArray));
422
        /*if(obj) {
423
            result = (jobject)obj;
424
        }*/
425
        if (comboArrays.stringArray != nullptr) {
426
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
427
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
428
        }
429
        if (result) {
430
            jclass atomicValueClass = lookForClass(SaxonProcessor::sxn_environ->env,
431
                                                   "net/sf/saxon/s9api/XdmAtomicValue");
432
            jclass nodeClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmNode");
433
            jclass functionItemClass = lookForClass(SaxonProcessor::sxn_environ->env,
434
                                                    "net/sf/saxon/s9api/XdmFunctionItem");
435
            XdmValue *value = nullptr;
436
            XdmItem *xdmItem = nullptr;
437

    
438

    
439
            if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, atomicValueClass) == JNI_TRUE) {
440
                xdmItem = new XdmAtomicValue(result);
441

    
442
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
443
                return xdmItem;
444

    
445
            } else if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, nodeClass) == JNI_TRUE) {
446
                xdmItem = new XdmNode(result);
447
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
448
                return xdmItem;
449
            } else if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, functionItemClass) == JNI_TRUE) {
450
                xdmItem = new XdmFunctionItem(result);
451
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
452
                return xdmItem;
453
            } else {
454
                value = new XdmValue(result, true);
455
                for (int z = 0; z < value->size(); z++) {
456
                }
457
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
458
                return value;
459
            }
460
        }
461
    }
462
    return nullptr;
463

    
464
}
465

    
466

    
467
void XsltExecutable::callFunctionReturningFile(const char *functionName, XdmValue **arguments, int argument_length,
468
                                               const char *outfile) {
469

    
470

    
471
    static jmethodID afmID = nullptr;
472

    
473
    if (afmID == nullptr) {
474
        afmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
475
                                                                                "callFunctionReturningFile",
476
                                                                                "(Ljava/lang/String;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;[Ljava/lang/String;[Ljava/lang/Object;)V");
477
    }
478

    
479
    if (!afmID) {
480
        std::cerr << "Error: " << getDllname() << "callFunctionReturningFile" << " not found\n"
481
                  << std::endl;
482
        SaxonProcessor::sxn_environ->env->ExceptionClear();
483
        return;
484
    } else {
485
        JParameters comboArrays;
486
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
487

    
488
        jobjectArray argumentJArray = SaxonProcessor::createJArray(arguments, argument_length);
489

    
490
        SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, afmID,
491
                                                                 SaxonProcessor::sxn_environ->env->NewStringUTF(
492
                                                                         cwdXE.c_str()),
493
                                                                 executableObject,
494
                                                                 (functionName != nullptr ?
495
                                                                  SaxonProcessor::sxn_environ->env->NewStringUTF(
496
                                                                          functionName) :
497
                                                                  nullptr), argumentJArray,
498
                                                                 (outfile != nullptr ?
499
                                                                  SaxonProcessor::sxn_environ->env->NewStringUTF(
500
                                                                          outfile) :
501
                                                                  nullptr),
502
                                                                 comboArrays.stringArray, comboArrays.objectArray);
503
        if (comboArrays.stringArray != nullptr) {
504
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
505
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
506
        }
507
        if (argumentJArray != nullptr) {
508
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(argumentJArray);
509
        }
510

    
511
    }
512
    return;
513

    
514

    
515
}
516

    
517
const char *
518
XsltExecutable::callFunctionReturningString(const char *functionName, XdmValue **arguments, int argument_length) {
519

    
520

    
521
    static jmethodID afsmID = nullptr;
522

    
523
    if(afsmID == nullptr) {
524
        (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
525
                                                                        "callFunctionReturningString",
526
                                                                        "(Ljava/lang/String;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;[Ljava/lang/Object;[Ljava/lang/String;[Ljava/lang/Object;)[B");
527
    }
528
    if (!afsmID) {
529
        std::cerr << "Error: " << getDllname() << "callFunctionReturningString" << " not found\n"
530
                  << std::endl;
531
        SaxonProcessor::sxn_environ->env->ExceptionClear();
532
    } else {
533
        JParameters comboArrays;
534
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
535
        jobjectArray argumentJArray = SaxonProcessor::createJArray(arguments, argument_length);
536

    
537
        jbyteArray result = nullptr;
538
        jobject obj = (SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, afsmID,
539
                                                                                SaxonProcessor::sxn_environ->env->NewStringUTF(
540
                                                                                        cwdXE.c_str()), executableObject,
541
                                                                                        (functionName != nullptr
542
                                                                                         ? SaxonProcessor::sxn_environ->env->NewStringUTF(
543
                                                                                                        functionName)
544
                                                                                         : nullptr),
545
                                                                                argumentJArray, comboArrays.stringArray,
546
                                                                                comboArrays.objectArray));
547
        if (obj) {
548
            result = (jbyteArray) obj;
549
        }
550
        if (comboArrays.stringArray != nullptr) {
551
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
552
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
553
        }
554
        if (result) {
555
            jboolean isCopy = false;
556
            jbyte* b = SaxonProcessor::sxn_environ->env->GetByteArrayElements(result, &isCopy);
557
            jsize num_bytes = SaxonProcessor::sxn_environ->env->GetArrayLength(result);
558

    
559
            const char *str = new char[num_bytes];
560
            memcpy ((void *) str, b , num_bytes );
561

    
562
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(obj);
563
            return str;
564
        }
565
    }
566
    return nullptr;
567
}
568

    
569

    
570
XdmValue *
571
XsltExecutable::callFunctionReturningValue(const char *functionName, XdmValue **arguments, int argument_length) {
572

    
573

    
574
    static jmethodID cfvmID = nullptr;
575
    if (cfvmID == nullptr) {
576
        cfvmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
577
                                                                                 "callFunctionReturningValue",
578
                                                                                 "(Ljava/lang/String;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;[Ljava/lang/Object;[Ljava/lang/String;[Ljava/lang/Object;)Lnet/sf/saxon/s9api/XdmValue;");
579
    }
580
    if (!cfvmID) {
581
        std::cerr << "Error: " << getDllname() << "callFunctionReturningValue" << " not found\n"
582
                  << std::endl;
583
        SaxonProcessor::sxn_environ->env->ExceptionClear();
584
    } else {
585
        JParameters comboArrays;
586
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
587
        jobjectArray argumentJArray = SaxonProcessor::createJArray(arguments, argument_length);
588

    
589
        jobject result = (jobject) (SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, cfvmID,
590
                                                                                             SaxonProcessor::sxn_environ->env->NewStringUTF(
591
                                                                                                     cwdXE.c_str()),
592
                                                                                             executableObject,
593
                                                                                             (functionName != nullptr
594
                                                                                              ? SaxonProcessor::sxn_environ->env->NewStringUTF(
595
                                                                                                             functionName)
596
                                                                                              : nullptr),
597
                                                                                             argumentJArray,
598
                                                                                             comboArrays.stringArray,
599
                                                                                             comboArrays.objectArray));
600

    
601
        if (comboArrays.stringArray != nullptr) {
602
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
603
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
604
        }
605
        if (argumentJArray != nullptr) {
606
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(argumentJArray);
607
        }
608
        if (result) {
609
            jclass atomicValueClass = lookForClass(SaxonProcessor::sxn_environ->env,
610
                                                   "net/sf/saxon/s9api/XdmAtomicValue");
611
            jclass nodeClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmNode");
612
            jclass functionItemClass = lookForClass(SaxonProcessor::sxn_environ->env,
613
                                                    "net/sf/saxon/s9api/XdmFunctionItem");
614
            XdmValue *value = nullptr;
615
            XdmItem *xdmItem = nullptr;
616

    
617

    
618
            if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, atomicValueClass) == JNI_TRUE) {
619
                xdmItem = new XdmAtomicValue(result);
620
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
621
                return xdmItem;
622
            } else if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, nodeClass) == JNI_TRUE) {
623
                xdmItem = new XdmNode(result);
624
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
625
                return xdmItem;
626

    
627
            } else if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, functionItemClass) == JNI_TRUE) {
628
                xdmItem = new XdmFunctionItem(result);
629
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
630
                return xdmItem;
631
            } else {
632
                value = new XdmValue(result, true);
633
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
634
                return value;
635
            }
636
            value = new XdmValue();
637
            value->addUnderlyingValue(result);
638
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
639
            return value;
640
        }
641
    }
642
    return nullptr;
643

    
644
}
645

    
646

    
647
void XsltExecutable::callTemplateReturningFile(const char *templateName, const char *outfile) {
648

    
649

    
650
    static jmethodID ctmID = nullptr;
651

    
652
    if(ctmID == nullptr) {
653
        ctmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
654
                                                                        "callTemplateReturningFile",
655
                                                                        "(Ljava/lang/String;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)V");
656
    }
657
    if (!ctmID) {
658
        std::cerr << "Error: " << getDllname() << "callTemplateReturningFile" << " not found\n"
659
                  << std::endl;
660
        SaxonProcessor::sxn_environ->env->ExceptionClear();
661
    } else {
662
        JParameters comboArrays;
663
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
664
        SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, ctmID,
665
                                                                 SaxonProcessor::sxn_environ->env->NewStringUTF(
666
                                                                         cwdXE.c_str()),
667
                                                                 executableObject,
668
                                                                 (templateName != nullptr
669
                                                                  ? SaxonProcessor::sxn_environ->env->NewStringUTF(
670
                                                                                 templateName) : nullptr),
671
                                                                 (outfile != nullptr
672
                                                                  ? SaxonProcessor::sxn_environ->env->NewStringUTF(
673
                                                                                 outfile) : nullptr),
674
                                                                 comboArrays.stringArray, comboArrays.objectArray);
675
        if (comboArrays.stringArray != nullptr) {
676
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
677
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
678
        }
679

    
680

    
681
    }
682

    
683
}
684

    
685

    
686
const char *XsltExecutable::callTemplateReturningString(const char *templateName) {
687

    
688

    
689
    jmethodID ctsmID = nullptr;
690

    
691
    if(ctsmID == nullptr) {
692
        ctsmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
693
                                                                        "callTemplateReturningString",
694
                                                                        "(Ljava/lang/String;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)[B");
695
    }
696
    if (!ctsmID) {
697
        std::cerr << "Error: " << getDllname() << "callTemplateReturningString" << " not found\n"
698
                  << std::endl;
699
        SaxonProcessor::sxn_environ->env->ExceptionClear();
700
    } else {
701
        JParameters comboArrays;
702
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
703

    
704

    
705
        jbyteArray result = nullptr;
706
        jobject obj = (jobject) (SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, ctsmID,
707
                                                                                          SaxonProcessor::sxn_environ->env->NewStringUTF(
708
                                                                                                  cwdXE.c_str()),
709
                                                                                          executableObject,
710
                                                                                          (templateName != nullptr
711
                                                                                           ? SaxonProcessor::sxn_environ->env->NewStringUTF(
712
                                                                                                          templateName)
713
                                                                                           : nullptr),
714
                                                                                          comboArrays.stringArray,
715
                                                                                          comboArrays.objectArray));
716
        if (obj) {
717
            result = (jbyteArray) obj;
718
        }
719
        if (comboArrays.stringArray != nullptr) {
720
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
721
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
722
        }
723
        if (result) {
724
            jboolean isCopy = false;
725
            jbyte* b = SaxonProcessor::sxn_environ->env->GetByteArrayElements(result, &isCopy);
726
            jsize num_bytes = SaxonProcessor::sxn_environ->env->GetArrayLength(result);
727

    
728
            const char *str = new char[num_bytes];
729
            memcpy ((void *) str, b , num_bytes );
730

    
731
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(obj);
732
            return str;
733
        }
734
    }
735
    return nullptr;
736

    
737

    
738
}
739

    
740
XdmValue *XsltExecutable::callTemplateReturningValue(const char *templateName) {
741

    
742

    
743
    static jmethodID ctsvmID = nullptr;
744
    if (ctsvmID == nullptr) {
745
        ctsvmID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
746
                                                                                 "callTemplateReturningValue",
747
                                                                                 "(Ljava/lang/String;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)Lnet/sf/saxon/s9api/XdmValue;");
748
    }
749
    if (!ctsvmID) {
750
        std::cerr << "Error: " << getDllname() << "callTemplateReturningValue" << " not found\n"
751
                  << std::endl;
752
        SaxonProcessor::sxn_environ->env->ExceptionClear();
753
    } else {
754
        JParameters comboArrays;
755
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
756

    
757

    
758
        jstring result = nullptr;
759
        jobject obj = (jobject) (SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, ctsvmID,
760
                                                                                          SaxonProcessor::sxn_environ->env->NewStringUTF(
761
                                                                                                  cwdXE.c_str()),
762
                                                                                          executableObject,
763
                                                                                          (templateName != nullptr
764
                                                                                           ? SaxonProcessor::sxn_environ->env->NewStringUTF(
765
                                                                                                          templateName)
766
                                                                                           : nullptr),
767
                                                                                          comboArrays.stringArray,
768
                                                                                          comboArrays.objectArray));
769
        if (obj) {
770
            result = (jstring) obj;
771
        }
772
        if (comboArrays.stringArray != nullptr) {
773
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
774
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
775
        }
776
        if (result) {
777
            jclass atomicValueClass = lookForClass(SaxonProcessor::sxn_environ->env,
778
                                                   "net/sf/saxon/s9api/XdmAtomicValue");
779
            jclass nodeClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmNode");
780
            jclass functionItemClass = lookForClass(SaxonProcessor::sxn_environ->env,
781
                                                    "net/sf/saxon/s9api/XdmFunctionItem");
782
            XdmValue *value = nullptr;
783

    
784
            XdmItem *xdmItem = nullptr;
785
            if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, atomicValueClass) == JNI_TRUE) {
786
                xdmItem = new XdmAtomicValue(result);
787
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
788
                return xdmItem;
789

    
790
            } else if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, nodeClass) == JNI_TRUE) {
791
                xdmItem = new XdmNode(result);
792
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
793
                return xdmItem;
794
            } else if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, functionItemClass) == JNI_TRUE) {
795
                xdmItem = new XdmFunctionItem(result);
796
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
797
                return xdmItem;
798
            } else {
799
                value = new XdmValue(result, true);
800
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
801
                return value;
802
            }
803
            value = new XdmValue();
804
            value->addUnderlyingValue(result);
805
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
806
            return value;
807
        }
808
    }
809
    return nullptr;
810
}
811

    
812

    
813
XdmValue *XsltExecutable::transformFileToValue(const char *sourcefile) {
814

    
815
    if (sourcefile == nullptr) {
816

    
817
        return nullptr;
818
    }
819

    
820

    
821
    static jmethodID tfvMID = nullptr;
822

    
823
    if (tfvMID == nullptr) {
824
        tfvMID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
825
                                                                                 "transformToValue",
826
                                                                                 "(Ljava/lang/String;Lnet/sf/saxon/option/cpp/Xslt30Processor;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)Lnet/sf/saxon/s9api/XdmValue;");
827
    }
828
    if (!tfvMID) {
829
        std::cerr << "Error: " << getDllname() << ".transformtoValue" << " not found\n"
830
                  << std::endl;
831
        SaxonProcessor::sxn_environ->env->ExceptionClear();
832
    } else {
833
        JParameters comboArrays;
834
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
835

    
836
        jobject result = (jobject) (
837
                SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, tfvMID,
838
                                                                         SaxonProcessor::sxn_environ->env->NewStringUTF(
839
                                                                                 cwdXE.c_str()), nullptr, executableObject,
840
                                                                         (sourcefile != nullptr
841
                                                                          ? SaxonProcessor::sxn_environ->env->NewStringUTF(
842
                                                                                         sourcefile) : nullptr),
843
                                                                         comboArrays.stringArray,
844
                                                                         comboArrays.objectArray));
845
        if (comboArrays.stringArray != nullptr) {
846
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
847
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
848
        }
849
        if (result) {
850
            jclass atomicValueClass = lookForClass(SaxonProcessor::sxn_environ->env,
851
                                                   "net/sf/saxon/s9api/XdmAtomicValue");
852
            jclass nodeClass = lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/s9api/XdmNode");
853
            jclass functionItemClass = lookForClass(SaxonProcessor::sxn_environ->env,
854
                                                    "net/sf/saxon/s9api/XdmFunctionItem");
855
            jclass mapItemClass = lookForClass(SaxonProcessor::sxn_environ->env,
856
                                                    "net/sf/saxon/s9api/XdmMap");
857
            jclass arrayItemClass = lookForClass(SaxonProcessor::sxn_environ->env,
858
                                               "net/sf/saxon/s9api/XdmArray");
859
            XdmValue *value = nullptr;
860
            XdmItem *xdmItem = nullptr;
861

    
862

    
863
            if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, atomicValueClass) == JNI_TRUE) {
864
                xdmItem = new XdmAtomicValue(result);
865
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
866
                return xdmItem;
867

    
868
            } else if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, nodeClass) == JNI_TRUE) {
869
                xdmItem = new XdmNode(result);
870
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
871
                return xdmItem;
872

    
873
            } else if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, functionItemClass) == JNI_TRUE) {
874
                xdmItem = new XdmFunctionItem(result);
875
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
876
                return xdmItem;
877
            } else if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, mapItemClass) == JNI_TRUE) {
878
                xdmItem = new XdmMap(result);
879
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
880
                return xdmItem;
881
            } else if (SaxonProcessor::sxn_environ->env->IsInstanceOf(result, arrayItemClass) == JNI_TRUE) {
882
                xdmItem = new XdmArray(result);
883
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
884
                return xdmItem;
885
            } else {
886
                value = new XdmValue(result, true);
887
                return value;
888
            }
889
            value = new XdmValue();
890
            value->addUnderlyingValue(result);
891

    
892
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(result);
893
            return value;
894
        }
895
    }
896
    return nullptr;
897

    
898
}
899

    
900

    
901
void XsltExecutable::transformFileToFile(const char *source, const char *outputfile) {
902

    
903

    
904
    static jmethodID tffMID = nullptr;
905

    
906
    if (tffMID == nullptr) {
907
        tffMID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
908
                                                                                 "transformToFile",
909
                                                                                 "(Ljava/lang/String;Lnet/sf/saxon/option/cpp/Xslt30Processor;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)V");
910
    }
911
    if (!tffMID) {
912
        std::cerr << "Error: " << getDllname() << "transformToFile" << " not found\n"
913
                  << std::endl;
914
        SaxonProcessor::sxn_environ->env->ExceptionClear();
915
    } else {
916
        JParameters comboArrays;
917
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
918

    
919
        SaxonProcessor::sxn_environ->env->CallStaticVoidMethod(cppClass, tffMID,
920
                                                               SaxonProcessor::sxn_environ->env->NewStringUTF(
921
                                                                       cwdXE.c_str()), nullptr, executableObject,
922
                                                                       (source != nullptr
923
                                                                        ? SaxonProcessor::sxn_environ->env->NewStringUTF(
924
                                                                                       source) : nullptr), nullptr,
925
                                                               (outputfile != nullptr
926
                                                                ? SaxonProcessor::sxn_environ->env->NewStringUTF(
927
                                                                               outputfile) : nullptr),
928
                                                               comboArrays.stringArray, comboArrays.objectArray);
929
        if (comboArrays.stringArray != nullptr) {
930
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
931
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
932
        }
933
    }
934

    
935
}
936

    
937

    
938
void XsltExecutable::setupXslMessage(bool create, const char * filename) {
939
    if (create) {
940

    
941
        static jmethodID messageID =   nullptr;
942
        if(messageID == nullptr) {
943
            messageID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(messageListenerClass,
944
                                                                                  "<init>",
945
                                                                                  "(Ljava/lang/String;Ljava/lang/String;)V");
946
        }
947
        if (!messageID) {
948
            std::cerr << "Error: "<<"SaxonCMessageListener" << " in " <<getDllname() << " not found\n"
949
                      << std::endl;
950
            SaxonProcessor::sxn_environ->env->ExceptionClear();
951
        }
952

    
953
        if (filename == nullptr) {
954
            saxonMessageListenerObj = (jobject)SaxonProcessor::sxn_environ->env->NewObject(messageListenerClass, messageID,
955
                                                                                           SaxonProcessor::sxn_environ->env->NewStringUTF("-:on"));
956
            //setProperty("m", "on");
957
        } else {
958
            saxonMessageListenerObj = (jobject)SaxonProcessor::sxn_environ->env->NewObject(messageListenerClass, messageID,
959
                                                                                           SaxonProcessor::sxn_environ->env->NewStringUTF(filename));
960
        }
961
    } else {
962
        setProperty("m", "off");
963
    }
964

    
965

    
966
}
967

    
968
XdmValue * XsltExecutable::getXslMessages(){
969

    
970
    if(saxonMessageListenerObj) {
971
        static jmethodID getmessageID = (jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(messageListenerClass,
972
                                                                                                  "getXslMessages",
973
                                                                                                  "()[Lnet/sf/saxon/s9api/XdmNode;");
974
        if (!getmessageID) {
975
            std::cerr << "Error: " << getDllname() << ".getXslMessages" << " not found\n"
976
                      << std::endl;
977
            SaxonProcessor::sxn_environ->env->ExceptionClear();
978
        } else {
979
            jobjectArray results = (jobjectArray) (
980
                    SaxonProcessor::sxn_environ->env->CallObjectMethod(saxonMessageListenerObj, getmessageID));
981
            int sizex = SaxonProcessor::sxn_environ->env->GetArrayLength(results);
982

    
983
            if (sizex > 0) {
984
                XdmValue *value = new XdmValue();
985

    
986
                for (int p = 0; p < sizex; ++p) {
987
                    jobject resulti = SaxonProcessor::sxn_environ->env->GetObjectArrayElement(results, p);
988
                    value->addUnderlyingValue(resulti);
989
                }
990
                SaxonProcessor::sxn_environ->env->DeleteLocalRef(results);
991
                return value;
992
            }
993
        }
994
    }
995
    return NULL;
996

    
997

    
998
}
999

    
1000

    
1001
const char *XsltExecutable::transformFileToString(const char *source) {
1002

    
1003

    
1004
    static jmethodID tftMID = tftMID;
1005
    if (tftMID == nullptr) {
1006
        tftMID = (jmethodID) SaxonProcessor::sxn_environ->env->GetStaticMethodID(cppClass,
1007
                                                                                 "transformToString",
1008
                                                                                 "(Ljava/lang/String;Lnet/sf/saxon/option/cpp/Xslt30Processor;Lnet/sf/saxon/s9api/XsltExecutable;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;)[B");
1009
    }
1010
    if (!tftMID) {
1011
        std::cerr << "Error: " << getDllname() << "transformToString" << " not found\n"
1012
                  << std::endl;
1013
        SaxonProcessor::sxn_environ->env->ExceptionClear();
1014
    } else {
1015
        JParameters comboArrays;
1016
        comboArrays = SaxonProcessor::createParameterJArray(parameters, properties);
1017

    
1018
        jbyteArray result = nullptr;
1019
        jobject obj = SaxonProcessor::sxn_environ->env->CallStaticObjectMethod(cppClass, tftMID,
1020
                                                                               SaxonProcessor::sxn_environ->env->NewStringUTF(
1021
                                                                                       cwdXE.c_str()), nullptr,
1022
                                                                               executableObject,
1023
                                                                               (source != nullptr
1024
                                                                                ? SaxonProcessor::sxn_environ->env->NewStringUTF(
1025
                                                                                               source) : nullptr),
1026
                                                                               nullptr,
1027
                                                                               comboArrays.stringArray,
1028
                                                                               comboArrays.objectArray);
1029
        if (comboArrays.stringArray != nullptr) {
1030
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.stringArray);
1031
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(comboArrays.objectArray);
1032
        }
1033
        if (obj) {
1034
            result = (jbyteArray) obj;
1035
        }
1036
        if (result) {
1037

    
1038
            jboolean isCopy = false;
1039
            jbyte* b = SaxonProcessor::sxn_environ->env->GetByteArrayElements(result, &isCopy);
1040
            jsize num_bytes = SaxonProcessor::sxn_environ->env->GetArrayLength(result);
1041

    
1042
            const char *str = new char[num_bytes];
1043
            memcpy ((void *) str, b , num_bytes );
1044

    
1045
            SaxonProcessor::sxn_environ->env->DeleteLocalRef(obj);
1046
            return str;
1047
        }
1048
    }
1049
    return nullptr;
1050
}
1051

    
1052

    
1053
const char *XsltExecutable::transformToString(XdmNode *source) {
1054

    
1055
    if (source != nullptr) {
1056
        source->incrementRefCount();
1057
        parameters["node"] = source;
1058
    }
1059
    return transformFileToString(nullptr);
1060
}
1061

    
1062

    
1063
XdmValue *XsltExecutable::transformToValue(XdmNode *source) {
1064

    
1065
    if (source != nullptr) {
1066
        source->incrementRefCount();
1067
        parameters["node"] = source;
1068
    }
1069
    return transformFileToValue(nullptr);
1070
}
1071

    
1072
void XsltExecutable::transformToFile(XdmNode *source) {
1073

    
1074
    if (source != nullptr) {
1075
        source->incrementRefCount();
1076
        parameters["node"] = source;
1077
    }
1078
    transformFileToFile(nullptr, nullptr);
1079
}
1080

    
1081

    
1082
SaxonApiException *XsltExecutable::getException() {
1083
    return SaxonProcessor::checkForExceptionCPP(SaxonProcessor::sxn_environ->env, cppClass, nullptr);
1084
}
(39-39/55)