beta.xslt.RuntimeOptions
¶
The beta.xslt.RuntimeOptions
class is used to initialize the dynamic context components for the execution of an beta.xslt.Stylesheet
.
-
class
beta.xslt.
RuntimeOptions
(Session session, bool _report_unknown_args=True, *, **kwargs)¶
Attributes¶
-
beta.xslt.RuntimeOptions.
base_output_uri
¶ The URI of the principal result document; also used as the base URI for resolving relative URIs of secondary result documents.
-
beta.xslt.RuntimeOptions.
current_datetime
¶ An
xsd.dateTime
value used for the current-dateTime component of the dynamic context. If absent, the system time will be used for the execution.
-
beta.xslt.RuntimeOptions.
debugger
¶
-
beta.xslt.RuntimeOptions.
delivery_format
¶ One of the enumeration values
beta.xpath.DeliveryFormat
. When saving of result documents is selected, then thebeta.xslt.RuntimeOptions.output_stream_factory
must be set as well.
-
beta.xslt.RuntimeOptions.
function_params
¶ An
beta.xpath.ArrayItem
used as the arguments to the initial function call.
-
beta.xslt.RuntimeOptions.
global_context_item
¶ An
beta.xpath.Item
that acts as the global context item for the transformation. The default value is set frombeta.xslt.RuntimeOptions.source_node
.
-
beta.xslt.RuntimeOptions.
initial_function
¶ The
xsd.QName
of the initial function to be called for call-function invocation. The arity of the function is inferred from the array length ofbeta.xslt.RuntimeOptions.function_params
.
-
beta.xslt.RuntimeOptions.
initial_match_selection
¶ An
beta.xpath.Sequence
that acts as the initial match selection corresponding to an initial xsl:apply-templates. The default value is set frombeta.xslt.RuntimeOptions.source_node
.
-
beta.xslt.RuntimeOptions.
initial_mode
¶ The name of the initial processing mode.
-
beta.xslt.RuntimeOptions.
initial_template
¶ The
xsd.QName
of a named template in the stylesheet to act as the initial entry point. If no template name is supplied, the default template name is ‘xsl:initial-template’.
-
beta.xslt.RuntimeOptions.
message_target
¶
-
beta.xslt.RuntimeOptions.
output_stream_factory
¶ This object is required to provide the output stream(s) for the final result(s), when saving of result documents is specified in
beta.xslt.RuntimeOptions.delivery_format
. The factory member is invoked with thebeta.xpath.Result.uri
of the currently constructed/processed result. The binary octets resulting from the serialization and encoding of the result are written to the provided output stream. Seebeta.xslt.RuntimeOptions.base_output_uri
andbeta.xslt.RuntimeOptions.serialization_params
for further options. Note: When writing large amount of data to disk, use buffered io objects for better performance.The factory object must have create_stream(uri: str) method and the created stream object must have a write() method.
>>> from urllib.parse import urlparse >>> from urllib.request import url2pathname >>> from pathlib import Path >>> >>> class OutputStream: >>> '''A sample output stream class that wraps a file object.''' >>> def __init__(self, file_path): >>> self.f = open(file_path, 'wb') >>> >>> def __del__(self): >>> self.f.close() >>> >>> def write(self, data): >>> self.f.write(data) >>> >>> class OutputStreamFactory: >>> '''A demo class to convert uri to os specific path and create eventually missing directory structure for the output.''' >>> def create_stream(self, uri): >>> p = Path(url2pathname(urlparse(uri).path)) >>> Path(p / '..').mkdir(parents=True, exist_ok=True) >>> return OutputStream(p) >>> >>> opts.output_stream_factory = OutputStreamFactory() >>> opts.delivery_format = :obj:`beta.xpath.DeliveryFormat.SAVED`
-
beta.xslt.RuntimeOptions.
serialization_params
¶ Overrides the values of the unnamed xsl:output
-
beta.xslt.RuntimeOptions.
source_node
¶ A
beta.xpath.NodeItem
that sets the default values for both thebeta.xslt.RuntimeOptions.global_context_item
and thebeta.xslt.RuntimeOptions.initial_match_selection
.
-
beta.xslt.RuntimeOptions.
stylesheet_params
¶ A
beta.xpath.MapItem
holding the values to be supplied for stylesheet parameters. Thebeta.xpath.AtomicItem
keys are created to match thexsd.QName
of the corresponding parameter, while the values are provided asbeta.xpath.Sequence
.
-
beta.xslt.RuntimeOptions.
template_params
¶ A
beta.xpath.MapItem
holding the values of non-tunnel parameters to be supplied to the initial template, used with both apply-templates and call-template invocation. Thebeta.xpath.AtomicItem
keys are created to match thexsd.QName
of the corresponding parameter, while the values are provided asbeta.xpath.Sequence
.
-
beta.xslt.RuntimeOptions.
trace_target
¶
-
beta.xslt.RuntimeOptions.
tunnel_params
¶ A
beta.xpath.MapItem
holding the values of tunnel parameters to be supplied to the initial template, used with both apply-templates and call-template invocation. Thebeta.xpath.AtomicItem
keys are created to match thexsd.QName
of the corresponding parameter, while the values are provided asbeta.xpath.Sequence
.
-
beta.xslt.RuntimeOptions.
xml_document_options_provider
¶
Special methods¶
__eq__, __ge__, __gt__, __le__, __lt__, __ne__