#include <XsltProcessor.h>
Public Member Functions | |
| XsltProcessor () | |
| Default constructor. More... | |
| XsltProcessor (SaxonProcessor *proc, std::string cwd="") | |
| Constructor with the SaxonProcessor supplied. More... | |
| void | setcwd (const char *cwd) |
| set the current working directory More... | |
| void | setSourceFromXdmValue (XdmItem *value) |
| Set the source document from a XdmValue for the transformation. More... | |
| void | setSourceFromFile (const char *filename) |
| void | setOutputFile (const char *outfile) |
| void | setParameter (const char *name, XdmValue *value) |
| XdmValue * | getParameter (const char *name) |
| bool | removeParameter (const char *name) |
| void | setProperty (const char *name, const char *value) |
| const char * | getProperty (const char *name) |
| std::map< std::string, XdmValue * > & | getParameters () |
| Get all parameters as a std::map. More... | |
| std::map< std::string, std::string > & | getProperties () |
| Get all properties as a std::map. More... | |
| void | clearParameters (bool deleteValues=false) |
| Clear parameter values set. More... | |
| void | clearProperties () |
| Clear property values set. | |
| XdmValue * | getXslMessages () |
| void | transformFileToFile (const char *sourcefile, const char *stylesheetfile, const char *outputfile) |
| Perform a one shot transformation. More... | |
| const char * | transformFileToString (const char *sourcefile, const char *stylesheetfile) |
| Perform a one shot transformation. More... | |
| XdmValue * | transformFileToValue (const char *sourcefile, const char *stylesheetfile) |
| void | compileFromFile (const char *stylesheet) |
| compile a stylesheet file. More... | |
| void | compileFromString (const char *stylesheet) |
| compile a stylesheet received as a string. More... | |
| void | compileFromStringAndSave (const char *stylesheet, const char *filename) |
| compile a stylesheet received as a string and save to SEF file. More... | |
| void | compileFromFileAndSave (const char *xslFilename, const char *filename) |
| compile a stylesheet received as a fileand save to SEF file. More... | |
| void | compileFromXdmNode (XdmNode *node) |
| compile a stylesheet received as an XdmNode. More... | |
| void | releaseStylesheet () |
| Internal method to release cached stylesheet. More... | |
| const char * | transformToString () |
| Execute transformation to string. Properties supplied in advance. More... | |
| XdmValue * | transformToValue () |
| Execute transformation to Xdm Value. Properties supplied in advance. More... | |
| void | transformToFile () |
| Execute transformation to file. Properties supplied in advance. More... | |
| bool | exceptionOccurred () |
| const char * | checkException () |
| Check for exception thrown. More... | |
| void | exceptionClear () |
| Clear any exception thrown. | |
| int | exceptionCount () |
| Get number of errors reported during execution or evaluate of stylesheet. More... | |
| const char * | getErrorMessage (int i) |
| Get the ith error message if there are any error. More... | |
| const char * | getErrorCode (int i) |
| Get the ith error code if there are any error. More... | |
| SaxonProcessor * | getSaxonProcessor () |
| Get the SaxonProcessor object. More... | |
An XsltProcessor represents factory to compile, load and execute a stylesheet. It is possible to cache the context and the stylesheet in the XsltProcessor.
| XsltProcessor::XsltProcessor | ( | ) |
Default constructor.
Creates a Saxon-HE product
| XsltProcessor::XsltProcessor | ( | SaxonProcessor * | proc, |
| std::string | cwd = "" |
||
| ) |
Constructor with the SaxonProcessor supplied.
| proc | - Supplied pointer to the SaxonProcessor object cwd - The current working directory |
| const char * XsltProcessor::checkException | ( | ) |
Check for exception thrown.
| void XsltProcessor::clearParameters | ( | bool | deleteValues = false | ) |
Clear parameter values set.
Default behaviour (false) is to leave XdmValues in memory true then XdmValues are deleted
| deleteValues. | Individual pointers to XdmValue objects have to be deleted in the calling program |
| void XsltProcessor::compileFromFile | ( | const char * | stylesheet | ) |
compile a stylesheet file.
The compiled stylesheet is cached and available for execution later.
| stylesheet | - The file name of the stylesheet document. |
| void XsltProcessor::compileFromFileAndSave | ( | const char * | xslFilename, |
| const char * | filename | ||
| ) |
compile a stylesheet received as a fileand save to SEF file.
The compiled stylesheet is saved as SEF to file store
| xslFilename | - file name of the stylesheet |
| filename | - the file to which the compiled package should be saved |
| void XsltProcessor::compileFromString | ( | const char * | stylesheet | ) |
compile a stylesheet received as a string.
The compiled stylesheet is cached and available for execution later.
| stylesheet | as a lexical string representation |
| void XsltProcessor::compileFromStringAndSave | ( | const char * | stylesheet, |
| const char * | filename | ||
| ) |
compile a stylesheet received as a string and save to SEF file.
The compiled stylesheet is saved as SEF to file store
| stylesheet | as a lexical string representation |
| filename | - the file to which the compiled package should be saved |
| void XsltProcessor::compileFromXdmNode | ( | XdmNode * | node | ) |
compile a stylesheet received as an XdmNode.
The compiled stylesheet is cached and available for execution later.
| stylesheet | as a lexical string representation |
| int XsltProcessor::exceptionCount | ( | ) |
Get number of errors reported during execution or evaluate of stylesheet.
A transformation may have a number of errors reported against it.
| bool XsltProcessor::exceptionOccurred | ( | ) |
Checks for pending exceptions without creating a local reference to the exception object
| const char * XsltProcessor::getErrorCode | ( | int | i | ) |
Get the ith error code if there are any error.
A transformation may have a number of errors reported against it.
| const char * XsltProcessor::getErrorMessage | ( | int | i | ) |
Get the ith error message if there are any error.
A transformation may have a number of errors reported against it.
| XdmValue * XsltProcessor::getParameter | ( | const char * | name | ) |
| std::map< std::string, XdmValue * > & XsltProcessor::getParameters | ( | ) |
Get all parameters as a std::map.
Please note that the key name has been prefixed with 'param:', for example 'param:name'
| std::map< std::string, std::string > & XsltProcessor::getProperties | ( | ) |
Get all properties as a std::map.
| const char * XsltProcessor::getProperty | ( | const char * | name | ) |
Get a property value by name
| name | - Specified paramater name to get |
|
inline |
Get the SaxonProcessor object.
| XdmValue * XsltProcessor::getXslMessages | ( | ) |
| void XsltProcessor::releaseStylesheet | ( | ) |
Internal method to release cached stylesheet.
| void |
| bool XsltProcessor::removeParameter | ( | const char * | name | ) |
Remove a parameter (name, value) pair from a stylesheet
| name | the name of the stylesheet parameter |
| void XsltProcessor::setcwd | ( | const char * | cwd | ) |
set the current working directory
| cwd | - Current working directory |
| void XsltProcessor::setOutputFile | ( | const char * | outfile | ) |
Set the output file of where the transformation result is sent
| void XsltProcessor::setParameter | ( | const char * | name, |
| XdmValue * | value | ||
| ) |
Set the value of a stylesheet parameter
| name | the name of the stylesheet parameter, as a string. For namespaced parameter use the JAXP solution i.e. "{uri}name" |
| value | the value of the stylesheet parameter, or null to clear a previously set value |
| void XsltProcessor::setProperty | ( | const char * | name, |
| const char * | value | ||
| ) |
Set a property specific to the processor in use. XsltProcessor: set serialization properties (names start with '!' i.e. name "!method" -> "xml") 'o':outfile name, 'it': initial template, 'im': initial mode, 's': source as file name 'm': switch on message listener for xsl:message instructions (TODO: this feature should be event based), 'item'| 'node' : source supplied as an XdmNode object
| name | of the property |
| value | of the property |
| void XsltProcessor::setSourceFromFile | ( | const char * | filename | ) |
Set the source from file for the transformation.
| void XsltProcessor::setSourceFromXdmValue | ( | XdmItem * | value | ) |
| void XsltProcessor::transformFileToFile | ( | const char * | sourcefile, |
| const char * | stylesheetfile, | ||
| const char * | outputfile | ||
| ) |
Perform a one shot transformation.
The result is stored in the supplied outputfile.
| sourcefile | - The file name of the source document |
| stylesheetfile | - The file name of the stylesheet document. If NULL the most recently compiled stylesheet is used |
| outputfile | - The file name where results will be stored |
| const char * XsltProcessor::transformFileToString | ( | const char * | sourcefile, |
| const char * | stylesheetfile | ||
| ) |
Perform a one shot transformation.
The result is returned as a string
| sourcefile | - The file name of the source document |
| stylesheetfile | - The file name of the stylesheet document. If NULL the most recently compiled stylesheet is used |
| XdmValue * XsltProcessor::transformFileToValue | ( | const char * | sourcefile, |
| const char * | stylesheetfile | ||
| ) |
| void XsltProcessor::transformToFile | ( | ) |
Execute transformation to file. Properties supplied in advance.
Perform the transformation based upon cached stylesheet and source document. Assume the outputfile has been set in advance
| const char * XsltProcessor::transformToString | ( | ) |
Execute transformation to string. Properties supplied in advance.
Perform the transformation based upon what has been cached.
| XdmValue * XsltProcessor::transformToValue | ( | ) |
Execute transformation to Xdm Value. Properties supplied in advance.
Perform the transformation based upon cached stylesheet and any source document.
1.8.6