SaxonC 12.10.0
Saxon Processor library for C/C++, PHP and Python
Loading...
Searching...
No Matches
Xslt30Processor.h
1
2// Copyright (c) 2022 - 2025 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 "saxonc_export.h"
14#include "saxonc/SaxonProcessor.h"
15//#include "XdmValue.h"
16#include <string>
17
18class SaxonProcessor;
20class XsltExecutable;
21class XdmValue;
22class XdmItem;
23class XdmNode;
24
29class SAXONC_EXPORT Xslt30Processor {
30
31 friend class XsltExecutable;
32
33public:
40
47 Xslt30Processor(SaxonProcessor *proc, std::string cwd = "");
48
53 Xslt30Processor(const Xslt30Processor &other);
54
56
62
71 void setcwd(const char *cwd);
72
73
80 const char * getcwd();
81
91 void setBaseOutputURI(const char *baseURI);
92
110 void setJustInTimeCompilation(bool jit);
111
120
126 void setTargetEdition(const char *edition);
127
136 void setXsltLanguageVersion(const char *version);
137
154 void setFastCompilation(bool fast);
155
163 void setRelocatable(bool relocatable);
164
177 void setParameter(const char *name, XdmValue *value);
178
184 XdmValue *getParameter(const char *name);
185
192 bool removeParameter(const char *name);
193
201 std::map<std::string, XdmValue *> &getParameters();
202
210 void clearParameters(bool deleteValues = false);
211
212
216 char **createCharArray(int len) { return (new char *[len]); }
217
224 void deleteXdmValueArray(XdmValue **arr, int len) {
225 delete[] arr;
226 }
227
237 void transformFileToFile(const char *sourcefile, const char *stylesheetfile,
238 const char *outputfile);
239
251 const char *transformFileToString(const char *sourcefile,
252 const char *stylesheetfile);
253
263 XdmValue *transformFileToValue(const char *sourcefile,
264 const char *stylesheetfile);
265
275 void importPackage(const char *packageFile);
276
290 XsltExecutable *compileFromFile(const char *stylesheet);
291
307 XsltExecutable *compileFromString(const char *stylesheet,
308 const char *encoding = nullptr);
309
323 XsltExecutable *compileFromAssociatedFile(const char *sourceFile);
324
333 void compileFromStringAndSave(const char *stylesheet, const char *filename,
334 const char *encoding = nullptr);
335
343 void compileFromFileAndSave(const char *xslFilename, const char *filename);
344
352 void compileFromXdmNodeAndSave(XdmNode *node, const char *filename);
353
367 XsltExecutable *compileFromXdmNode(XdmNode *node);
368
375 bool exceptionOccurred();
376
384 SaxonApiException *getException();
385
390 void exceptionClear();
391
398 const char *getErrorMessage();
399
407 const char *getErrorCode();
408
409private:
410 void createException(const char *message = nullptr);
411
421 void setProperty(const char *name, const char *value);
422
427 std::map<std::string, std::string> &getProperties();
428
432 void clearProperties();
433
434 //SaxonProcessor *proc; /*!< Pointer to the SaxonProcessor object which created this Xslt30Processor */
435
436 int64_t cppXT, procRef;
437 int64_t importPackageValue;
438 std::string cwdXT;
439 bool jitCompilation;
440 std::map<std::string, XdmValue *>
441 parameters;
443 std::map<std::string, std::string>
444 properties;
446 SaxonApiException *exception;
447};
448
449#endif /* SAXON_XSLT30_H */
SAXONC_EXPORT void setParameter(sxnc_parameter **parameters, int *parLen, int *parCap, const char *name, sxnc_value *value)
Set a parameter.
Definition SaxonCGlue.c:194
SAXONC_EXPORT int64_t getParameter(sxnc_parameter *parameters, int parLen, const char *name)
Get a parameter from the list.
Definition SaxonCGlue.c:170
SAXONC_EXPORT void setProperty(sxnc_property **properties, int *propLen, int *propCap, const char *name, const char *value)
Set a property.
Definition SaxonCGlue.c:220
EXTERN_SAXONC SAXONC_EXPORT const char * version(sxnc_environment *environi, sxnc_processor *proc)
Get the Saxon version.
Definition SaxonCProcessor.c:6
SaxonApiException.
Definition SaxonApiException.h:24
The SaxonProcessor class acts as a factory for generating XQuery, XPath, Schema and XSLT compilers.
Definition SaxonProcessor.h:117
The class XdmItem represents an item in a sequence, as defined by the XDM data model.
Definition XdmItem.h:31
This class represents a node in the XDM data model.
Definition XdmNode.h:57
An XdmValue represents a value in the XDM data model.
Definition XdmValue.h:33
std::map< std::string, XdmValue * > & getParameters()
Get all parameters as a std::map.
Definition Xslt30Processor.cpp:215
const char * getcwd()
Get the current working directory (cwd).
Definition Xslt30Processor.cpp:231
bool removeParameter(const char *name)
Remove a parameter (name, value) pair from a stylesheet.
Definition Xslt30Processor.cpp:156
char ** createCharArray(int len)
Utility method for working with SaxonC on Python - internal use only.
Definition Xslt30Processor.h:216
SaxonProcessor * getSaxonProcessor()
Get the SaxonProcessor object.
Definition Xslt30Processor.cpp:235
Xslt30Processor()
Default constructor.
Definition Xslt30Processor.cpp:21
void setcwd(const char *cwd)
Set the current working directory (cwd).
Definition Xslt30Processor.cpp:225
void setTargetEdition(const char *edition)
Set the target edition under which the stylesheet will be executed.
Definition Xslt30Processor.cpp:191
void setXsltLanguageVersion(const char *version)
Set the XSLT (and XPath) language level to be supported by the processor.
Definition Xslt30Processor.cpp:185
void clearParameters(bool deleteValues=false)
Clear stylesheet parameter values set.
Definition Xslt30Processor.cpp:197
void deleteXdmValueArray(XdmValue **arr, int len)
Utility method for Python API - internal use only.
Definition Xslt30Processor.h:224
bool getJustInTimeCompilation()
Get the status of the just-in-time compilation flag.
Definition Xslt30Processor.cpp:164
void setFastCompilation(bool fast)
Request fast compilation.
Definition Xslt30Processor.cpp:169
void setBaseOutputURI(const char *baseURI)
Set the base output URI.
Definition Xslt30Processor.cpp:128
void setJustInTimeCompilation(bool jit)
Say whether just-in-time compilation of template rules should be used.
Definition Xslt30Processor.cpp:160
void setRelocatable(bool relocatable)
Indicate that packages compiled by this processor are deployable to a different location.
Definition Xslt30Processor.cpp:177
An XsltExecutable represents the compiled form of a stylesheet.
Definition XsltExecutable.h:33