Xslt30Processor
class Xslt30Processor (View source)
Methods
File names to XSLT packages stored on filestore are added to a set of packages, which will be imported later for use when compiling.
Invoke the most recently compiled stylsheet by applying templates to a supplied input sequence (the initial match selection), saving the results to the file specified in the $fileName argument.
Invoke a stylesheet by applying templates to a supplied input sequence (the initial match selection). The result is returned as a serialized string. The stylesheet file name can be supplied as an argument here. If null then the most recently compiled stylsheet is used.
Invoke a stylesheet by applying templates to a supplied input sequence (the initial match selection). The result is returned as an XdmValue object. The stylesheet file name can be supplied as an argument here. If null then the most recently compiled stylsheet is used.
Get the stylesheet associated via the xml-stylesheet processing instruction (@link http://www.w3.org/TR/xml-stylesheet/) in the document specified in the $xmlFileName argument, and that match the given criteria. If there are several suitable xml-stylesheet processing instructions, then the returned source will identify a synthesized stylesheet module that imports all the referenced stylesheet modules.
Compile a stylesheet supplied as a file as specified by the $fileName argument.
Compile a stylesheet received as a string.
Compile a stylesheet supplied as a file as specified by the $fileName argument, and save as an exported file (SEF).
Compile a stylesheet received as a string and save as an exported file (SEF).
Compile a stylesheet received as an XdmNode and save as an exported file (SEF).
Call a public user-defined function in the stylesheet. Here we wrap the result in an XML document, and send this document to a specified file. The function name is supplied as a string, and the values of the arguments to be supplied to the function are supplied as an array of XdmValue objects. These will be converted if necessary to the type as defined in the function signature, using the function conversion rules.
Call a public user-defined function in the stylesheet. Here we wrap the result in an XML document, and serialize this document to a string value. The function name is supplied as a string, and the values of the arguments to be supplied to the function are supplied as an array of XdmValue objects. These will be converted if necessary to the type as defined in the function signature, using the function conversion rules.
Call a public user-defined function in the stylesheet. Here we wrap the result in an XML document, and return the document as an XdmValue}. The function name is supplied as a string, and the values of the arguments to be supplied to the function are supplied as an array of {@link XdmValue objects. These will be converted if necessary to the type as defined in the function signature, using the function conversion rules.
Invoke a transformation by calling a named template, saving the results to the file specified in the $outputFileName argument. If the $templateName argument is null then the xsl:initial-template is used. Parameters supplied using setInitialTemplateParameters() are made available to the called template.
Invoke a transformation by calling a named template, and return the result as a string. If the $templateName argument is null then the xsl:initial-template is used. Parameters supplied using setInitialTemplateParameters() are made available to the called template.
Invoke a transformation by calling a named template, and return the result as an XdmValue}. If the $templateName argument is null then the xsl:initial-template is used. Parameters supplied using {@link setInitialTemplateParameters() are made available to the called template.
Perform a one shot transformation, saving the results to the file specified in the $outputFileName argument.
Perform a one shot transformation. The result is returned as an XdmValue.
Perform a one shot transformation. The result is returned as a string.
Perform a one shot transformation, saving the results to the file as previously set (e.g. using setOutputFile()). The global context item may be supplied in the $context argument.
Perform a one shot transformation. The result is returned as a serialized string. The global context item may be supplied in the $context argument.
Perform a one shot transformation. The result is returned as an XdmValue object. If there are failures then a null is returned. The global context item may be supplied in the $context argument.
Set parameters to be passed to the initial template. These are used whether the transformation is invoked by applying templates to an initial context item, or by invoking a named template. The parameters in question are the xsl:param elements appearing as children of the xsl:template element. The $tunnel argument should be set to true if these values are to be used for setting tunnel parameters.
Set the initial value to which templates are to be applied (equivalent to the 'select' attribute of xsl:apply-templates).
Set the initial value to which templates are to be applied (equivalent to the 'select' attribute of xsl:apply-templates). This initial match selection is supplied as a file as specified by the $fileName argument.
Supply the context item to be used when evaluating global variables and parameters.
Supply the context item to be used when evaluating global variables and parameters, as a file as specified by the $fileName argument.
Set the output file to which the transformation result will be sent.
Set properties for the XSLT processor.
Say whether just-in-time compilation of template rules should be used.
Set true if the result of a transformation should be returned as a raw XdmValue} result, rather than as a result tree (an {@link XdmNode object with a Document node as its root).
Clear parameter values set.
Clear property values set.
Clear any exceptions thrown.
Get the i'th error code if there are any errors.
Get the i'th error message if there are any errors.
Get the number of errors during execution or evaluation of a stylesheet.
Details
void
addPackages(string[] $packageFileNames)
File names to XSLT packages stored on filestore are added to a set of packages, which will be imported later for use when compiling.
void
applyTemplatesReturningFile(string|null $stylesheetFileName, string $fileName)
Invoke the most recently compiled stylsheet by applying templates to a supplied input sequence (the initial match selection), saving the results to the file specified in the $fileName argument.
string
applyTemplatesReturningString(string $stylesheetFileName)
Invoke a stylesheet by applying templates to a supplied input sequence (the initial match selection). The result is returned as a serialized string. The stylesheet file name can be supplied as an argument here. If null then the most recently compiled stylsheet is used.
XdmValue
applyTemplatesReturningValue(string $stylesheetFileName)
Invoke a stylesheet by applying templates to a supplied input sequence (the initial match selection). The result is returned as an XdmValue object. The stylesheet file name can be supplied as an argument here. If null then the most recently compiled stylsheet is used.
void
compileFromAssociatedFile(string $xmlFileName)
Get the stylesheet associated via the xml-stylesheet processing instruction (@link http://www.w3.org/TR/xml-stylesheet/) in the document specified in the $xmlFileName argument, and that match the given criteria. If there are several suitable xml-stylesheet processing instructions, then the returned source will identify a synthesized stylesheet module that imports all the referenced stylesheet modules.
void
compileFromFile(string $fileName)
Compile a stylesheet supplied as a file as specified by the $fileName argument.
void
compileFromString(string $str)
Compile a stylesheet received as a string.
string|null
compileFromValue(XdmValue $node)
Compile a stylesheet received as an XdmValue.
void
compileFromFileAndSave(string $fileName, string $outputFileName)
Compile a stylesheet supplied as a file as specified by the $fileName argument, and save as an exported file (SEF).
void
compileFromStringAndSave(string $str, string $outputFileName)
Compile a stylesheet received as a string and save as an exported file (SEF).
void
compileFromValueAndSave(XdmNode $node, string $outputFileName)
Compile a stylesheet received as an XdmNode and save as an exported file (SEF).
void
callFunctionReturningFile(string $functionName, XdmValue[] $arguments, string $outputFileName)
Call a public user-defined function in the stylesheet. Here we wrap the result in an XML document, and send this document to a specified file. The function name is supplied as a string, and the values of the arguments to be supplied to the function are supplied as an array of XdmValue objects. These will be converted if necessary to the type as defined in the function signature, using the function conversion rules.
string
callFunctionReturningString(string $functionName, XdmValue[] $arguments)
Call a public user-defined function in the stylesheet. Here we wrap the result in an XML document, and serialize this document to a string value. The function name is supplied as a string, and the values of the arguments to be supplied to the function are supplied as an array of XdmValue objects. These will be converted if necessary to the type as defined in the function signature, using the function conversion rules.
XdmValue
callFunctionReturningValue(string $functionName, XdmValue[] $arguments)
Call a public user-defined function in the stylesheet. Here we wrap the result in an XML document, and return the document as an XdmValue}. The function name is supplied as a string, and the values of the arguments to be supplied to the function are supplied as an array of {@link XdmValue objects. These will be converted if necessary to the type as defined in the function signature, using the function conversion rules.
void
callTemplateReturningFile(string $stylesheetFileName, string|null $templateName, string $outputFileName)
Invoke a transformation by calling a named template, saving the results to the file specified in the $outputFileName argument. If the $templateName argument is null then the xsl:initial-template is used. Parameters supplied using setInitialTemplateParameters() are made available to the called template.
string
callTemplateReturningString(string $stylesheetFileName, string|null $templateName)
Invoke a transformation by calling a named template, and return the result as a string. If the $templateName argument is null then the xsl:initial-template is used. Parameters supplied using setInitialTemplateParameters() are made available to the called template.
XdmValue
callTemplateReturningValue(string $stylesheetFileName, string|null $templateName)
Invoke a transformation by calling a named template, and return the result as an XdmValue}. If the $templateName argument is null then the xsl:initial-template is used. Parameters supplied using {@link setInitialTemplateParameters() are made available to the called template.
void
transformFileToFile(string $sourceFileName, string $stylesheetFileName, string $outputFileName)
Perform a one shot transformation, saving the results to the file specified in the $outputFileName argument.
XdmValue|null
transformFileToValue(string $fileName)
Perform a one shot transformation. The result is returned as an XdmValue.
string
transformFileToString(string $fileName)
Perform a one shot transformation. The result is returned as a string.
void
transformToFile(XdmNode|null $context = null)
Perform a one shot transformation, saving the results to the file as previously set (e.g. using setOutputFile()). The global context item may be supplied in the $context argument.
string
transformToString(XdmNode|null $context = null)
Perform a one shot transformation. The result is returned as a serialized string. The global context item may be supplied in the $context argument.
XdmValue
transformToValue(XdmNode|null $context = null)
Perform a one shot transformation. The result is returned as an XdmValue object. If there are failures then a null is returned. The global context item may be supplied in the $context argument.
void
setInitialTemplateParameters(array $parameters, bool $tunnel)
Set parameters to be passed to the initial template. These are used whether the transformation is invoked by applying templates to an initial context item, or by invoking a named template. The parameters in question are the xsl:param elements appearing as children of the xsl:template element. The $tunnel argument should be set to true if these values are to be used for setting tunnel parameters.
void
setInitialMatchSelection(XdmValue $value)
Set the initial value to which templates are to be applied (equivalent to the 'select' attribute of xsl:apply-templates).
void
setInitialMatchSelectionAsFile(string $fileName)
Set the initial value to which templates are to be applied (equivalent to the 'select' attribute of xsl:apply-templates). This initial match selection is supplied as a file as specified by the $fileName argument.
void
setGlobalContextItem(XdmItem $item)
Supply the context item to be used when evaluating global variables and parameters.
void
setGlobalContextFromFile(string $fileName)
Supply the context item to be used when evaluating global variables and parameters, as a file as specified by the $fileName argument.
void
setOutputFile(string $fileName)
Set the output file to which the transformation result will be sent.
void
setParameter(string $name, XdmValue $value)
Set the parameters required for the XSLT stylesheet.
void
setProperty(string $name, string $value)
Set properties for the XSLT processor.
void
setJustInTimeCompilation(bool $value)
Say whether just-in-time compilation of template rules should be used.
void
setResultAsRawValue(bool $value)
Set true if the result of a transformation should be returned as a raw XdmValue} result, rather than as a result tree (an {@link XdmNode object with a Document node as its root).
void
clearParameters()
Clear parameter values set.
void
clearProperties()
Clear property values set.
void
exceptionClear()
Clear any exceptions thrown.
string
getErrorCode(int $i)
Get the i'th error code if there are any errors.
string
getErrorMessage(int $i)
Get the i'th error message if there are any errors.
int
getExceptionCount()
Get the number of errors during execution or evaluation of a stylesheet.