class Xslt30Processor (View source)

Methods

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.

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.

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.

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.

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.

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.

Parameters

string[] $packageFileNames

Return Value

void

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.

Parameters

string|null $stylesheetFileName
string $fileName

Return Value

void

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.

Parameters

string $stylesheetFileName

Return Value

string

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.

Parameters

string $stylesheetFileName

Return Value

XdmValue

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.

Parameters

string $xmlFileName

Return Value

void

void compileFromFile(string $fileName)

Compile a stylesheet supplied as a file as specified by the $fileName argument.

Parameters

string $fileName

Return Value

void

void compileFromString(string $str)

Compile a stylesheet received as a string.

Parameters

string $str

Return Value

void

string|null compileFromValue(XdmValue $node)

Compile a stylesheet received as an XdmValue.

Parameters

XdmValue $node

Return Value

string|null

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).

Parameters

string $fileName
string $outputFileName

Return Value

void

void compileFromStringAndSave(string $str, string $outputFileName)

Compile a stylesheet received as a string and save as an exported file (SEF).

Parameters

string $str
string $outputFileName

Return Value

void

void compileFromValueAndSave(XdmNode $node, string $outputFileName)

Compile a stylesheet received as an XdmNode and save as an exported file (SEF).

Parameters

XdmNode $node
string $outputFileName

Return Value

void

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.

Parameters

string $functionName
XdmValue[] $arguments
string $outputFileName

Return Value

void

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.

Parameters

string $functionName
XdmValue[] $arguments

Return Value

string

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.

Parameters

string $functionName
XdmValue[] $arguments

Return Value

XdmValue

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.

Parameters

string $stylesheetFileName
string|null $templateName
string $outputFileName

Return Value

void

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.

Parameters

string $stylesheetFileName
string|null $templateName

Return Value

string

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.

Parameters

string $stylesheetFileName
string|null $templateName

Return Value

XdmValue

void transformFileToFile(string $sourceFileName, string $stylesheetFileName, string $outputFileName)

Perform a one shot transformation, saving the results to the file specified in the $outputFileName argument.

Parameters

string $sourceFileName
string $stylesheetFileName
string $outputFileName

Return Value

void

XdmValue|null transformFileToValue(string $fileName)

Perform a one shot transformation. The result is returned as an XdmValue.

Parameters

string $fileName

Return Value

XdmValue|null

string transformFileToString(string $fileName)

Perform a one shot transformation. The result is returned as a string.

Parameters

string $fileName

Return Value

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.

Parameters

XdmNode|null $context

Return Value

void

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.

Parameters

XdmNode|null $context

Return Value

string

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.

Parameters

XdmNode|null $context

Return Value

XdmValue

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.

Parameters

array $parameters
bool $tunnel

Return Value

void

void setInitialMatchSelection(XdmValue $value)

Set the initial value to which templates are to be applied (equivalent to the 'select' attribute of xsl:apply-templates).

Parameters

XdmValue $value

Return Value

void

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.

Parameters

string $fileName

Return Value

void

void setGlobalContextItem(XdmItem $item)

Supply the context item to be used when evaluating global variables and parameters.

Parameters

XdmItem $item

Return Value

void

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.

Parameters

string $fileName

Return Value

void

void setOutputFile(string $fileName)

Set the output file to which the transformation result will be sent.

Parameters

string $fileName

Return Value

void

void setParameter(string $name, XdmValue $value)

Set the parameters required for the XSLT stylesheet.

Parameters

string $name
XdmValue $value

Return Value

void

void setProperty(string $name, string $value)

Set properties for the XSLT processor.

Parameters

string $name
string $value

Return Value

void

void setJustInTimeCompilation(bool $value)

Say whether just-in-time compilation of template rules should be used.

Parameters

bool $value

Return Value

void

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).

Parameters

bool $value

Return Value

void

void clearParameters()

Clear parameter values set.

Return Value

void

void clearProperties()

Clear property values set.

Return Value

void

void exceptionClear()

Clear any exceptions thrown.

Return Value

void

string getErrorCode(int $i)

Get the i'th error code if there are any errors.

Parameters

int $i

Return Value

string

string getErrorMessage(int $i)

Get the i'th error message if there are any errors.

Parameters

int $i

Return Value

string

int getExceptionCount()

Get the number of errors during execution or evaluation of a stylesheet.

Return Value

int