SaxonC 12.5
Saxon Processor library for C/C++, PHP and Python
Loading...
Searching...
No Matches
Xslt30Processor.h
1
2// Copyright (c) 2022 - 2023 Saxonica Limited.
3// This Source Code Form is subject to the terms of the Mozilla Public License,
4// v. 2.0. If a copy of the MPL was not distributed with this file, You can
5// obtain one at http://mozilla.org/MPL/2.0/. This Source Code Form is
6// "Incompatible With Secondary Licenses", as defined by the Mozilla Public
7// License, v. 2.0.
9
10#ifndef SAXON_XSLT30_H
11#define SAXON_XSLT30_H
12
13#include "SaxonProcessor.h"
14//#include "XdmValue.h"
15#include <string>
16
17class SaxonProcessor;
19class XsltExecutable;
20class XdmValue;
21class XdmItem;
22class XdmNode;
23
29
30 friend class XsltExecutable;
31
32public:
34
39
41
46 Xslt30Processor(SaxonProcessor *proc, std::string cwd = "");
47
52 Xslt30Processor(const Xslt30Processor &other);
53
55
57
61
63
70 void setcwd(const char *cwd);
71
73
81 void setBaseOutputURI(const char *baseURI);
82
84
100 void setJustInTimeCompilation(bool jit);
101
103
108 void setTargetEdition(const char *edition);
109
111
118 void setXsltLanguageVersion(const char *version);
119
121
135 void setFastCompilation(bool fast);
136
138
144 void setRelocatable(bool relocatable);
145
147
158 void setParameter(const char *name, XdmValue *value);
159
165 XdmValue *getParameter(const char *name);
166
173 bool removeParameter(const char *name);
174
176
183 std::map<std::string, XdmValue *> &getParameters();
184
186
192 void clearParameters(bool deleteValues = false);
193
194
198 XdmValue **createXdmValueArray(int len) { return (new XdmValue *[len]); }
199
203 char **createCharArray(int len) { return (new char *[len]); }
204
206
211 void deleteXdmValueArray(XdmValue **arr, int len) {
212 delete[] arr;
213 }
214
216
224 void transformFileToFile(const char *sourcefile, const char *stylesheetfile,
225 const char *outputfile);
226
228
236 const char *transformFileToString(const char *sourcefile,
237 const char *stylesheetfile);
238
247 XdmValue *transformFileToValue(const char *sourcefile,
248 const char *stylesheetfile);
249
251
259 void importPackage(const char *packageFile);
260
262
272 XsltExecutable *compileFromFile(const char *stylesheet);
273
275
288 XsltExecutable *compileFromString(const char *stylesheet,
289 const char *encoding = nullptr);
290
292 /* via the xml-stylesheet processing instruction (see
293 * http://www.w3.org/TR/xml-stylesheet/) with the document
294 * specified in the source parameter, and that match
295 * the given criteria. If there are several suitable xml-stylesheet
296 * processing instructions, then the returned Source will identify
297 * a synthesized stylesheet module that imports all the referenced
298 * stylesheet module.*/
309 XsltExecutable *compileFromAssociatedFile(const char *sourceFile);
310
313
321 void compileFromStringAndSave(const char *stylesheet, const char *filename,
322 const char *encoding = nullptr);
323
326
333 void compileFromFileAndSave(const char *xslFilename, const char *filename);
334
336
342 void compileFromXdmNodeAndSave(XdmNode *node, const char *filename);
343
345
356
363 bool exceptionOccurred();
364
366
372
374 void exceptionClear();
375
377
381 const char *getErrorMessage();
382
384
389 const char *getErrorCode();
390
391private:
392 void createException(const char *message = nullptr);
393
403 void setProperty(const char *name, const char *value);
404
406 void clearProperties();
407
408 SaxonProcessor *proc;
409 int64_t cppXT;
410 int64_t importPackageValue;
411 std::string cwdXT;
412 bool jitCompilation;
413 std::map<std::string, XdmValue *>
414 parameters;
416 std::map<std::string, std::string>
417 properties;
419 SaxonApiException *exception;
420};
421
422#endif /* SAXON_XSLT30_H */
Definition SaxonApiException.h:23
Definition SaxonProcessor.h:117
Definition XdmItem.h:30
Definition XdmNode.h:56
Definition XdmValue.h:42
Definition Xslt30Processor.h:28
XdmValue * getParameter(const char *name)
Definition Xslt30Processor.cpp:139
std::map< std::string, XdmValue * > & getParameters()
Get all parameters as a std::map.
Definition Xslt30Processor.cpp:201
bool removeParameter(const char *name)
Definition Xslt30Processor.cpp:147
bool exceptionOccurred()
Definition Xslt30Processor.cpp:115
char ** createCharArray(int len)
Definition Xslt30Processor.h:203
SaxonProcessor * getSaxonProcessor()
Get the SaxonProcessor object.
Definition Xslt30Processor.h:60
void compileFromStringAndSave(const char *stylesheet, const char *filename, const char *encoding=nullptr)
Definition Xslt30Processor.cpp:236
Xslt30Processor()
Default constructor.
Definition Xslt30Processor.cpp:21
void transformFileToFile(const char *sourcefile, const char *stylesheetfile, const char *outputfile)
Perform a one shot transformation.
Definition Xslt30Processor.cpp:491
SaxonApiException * getException()
Get the SaxonApiException object created when we have an error.
Definition Xslt30Processor.cpp:216
XsltExecutable * compileFromFile(const char *stylesheet)
compile a stylesheet file.
Definition Xslt30Processor.cpp:409
void importPackage(const char *packageFile)
Import a library package.
Definition Xslt30Processor.cpp:255
void setcwd(const char *cwd)
set the current working directory (cwd).
Definition Xslt30Processor.cpp:210
XdmValue ** createXdmValueArray(int len)
Definition Xslt30Processor.h:198
XsltExecutable * compileFromString(const char *stylesheet, const char *encoding=nullptr)
compile a stylesheet received as a string.
Definition Xslt30Processor.cpp:291
const char * transformFileToString(const char *sourcefile, const char *stylesheetfile)
Perform a one shot transformation.
Definition Xslt30Processor.cpp:536
void compileFromXdmNodeAndSave(XdmNode *node, const char *filename)
compile a stylesheet received as an XdmNode.
Definition Xslt30Processor.cpp:220
void setTargetEdition(const char *edition)
Set the target edition.
Definition Xslt30Processor.cpp:177
void setXsltLanguageVersion(const char *version)
Set the XSLT (and XPath) language level to be supported by the processor.
Definition Xslt30Processor.cpp:171
void setParameter(const char *name, XdmValue *value)
Set the value of a stylesheet parameter.
Definition Xslt30Processor.cpp:125
void clearParameters(bool deleteValues=false)
Clear parameter values set.
Definition Xslt30Processor.cpp:183
void deleteXdmValueArray(XdmValue **arr, int len)
Utility method for Python API - internal use only.
Definition Xslt30Processor.h:211
const char * getErrorMessage()
Get the first error message if there are any errors.
Definition Xslt30Processor.cpp:583
void setFastCompilation(bool fast)
Request fast compilation.
Definition Xslt30Processor.cpp:155
XdmValue * transformFileToValue(const char *sourcefile, const char *stylesheetfile)
Definition Xslt30Processor.cpp:449
void setBaseOutputURI(const char *baseURI)
Set the base output URI.
Definition Xslt30Processor.cpp:119
void setJustInTimeCompilation(bool jit)
Say whether just-in-time compilation of template rules should be used.
Definition Xslt30Processor.cpp:151
void compileFromFileAndSave(const char *xslFilename, const char *filename)
Definition Xslt30Processor.cpp:270
XsltExecutable * compileFromXdmNode(XdmNode *node)
compile a stylesheet received as an XdmNode.
Definition Xslt30Processor.cpp:334
const char * getErrorCode()
Get the first error code if there are any errors.
Definition Xslt30Processor.cpp:117
XsltExecutable * compileFromAssociatedFile(const char *sourceFile)
Get the stylesheet associated.
Definition Xslt30Processor.cpp:374
void exceptionClear()
Clear any exception thrown.
Definition Xslt30Processor.cpp:206
void setRelocatable(bool relocatable)
Indicate package deployable to a different location.
Definition Xslt30Processor.cpp:163
Definition XsltExecutable.h:29