| |
- builtins.object
-
- PyDocumentBuilder
- PySaxonProcessor
- PySchemaValidator
- PyXPathProcessor
- PyXQueryProcessor
- PyXdmValue
-
- PyXdmItem
-
- PyXdmAtomicValue
- PyXdmFunctionItem
-
- PyXdmArray
- PyXdmMap
- PyXdmNode
- PyXdmValueIterator
- PyXslt30Processor
- PyXsltExecutable
class PyDocumentBuilder(builtins.object) |
|
A PyDocumentBuilder holds properties controlling how a Saxon document tree should be built, and
* provides methods to invoke the tree construction.
* <p>This class has no public constructor. To construct a DocumentBuilder,
* use the factory method SaxonProcessor.newDocumentBuilder(). |
|
Methods defined here:
- __reduce__ = __reduce_cython__(...)
- __setstate__ = __setstate_cython__(...)
- get_schema_validator(...)
- get_schema_validator(self)
Get the SchemaValidator used to validate documents loaded using this DocumentBuilder
Returns:
PySchemaValidator: if one has been set; otherwise None.
- parse_xml(...)
- parse_xml(self, **kwds)
Parse a lexical representation, source file or uri of the source document and return it as an Xdm Node
Args:
**kwds : The possible keyword arguments must be one of the follow (xml_file_name|xml_text|xml_uri)
Returns:
PyXdmNode: The Xdm Node representation of the XML document
Raises:
Exception: Error if the keyword argument is not one of xml_file_name|xml_text|xml_uri.
- set_base_uri(...)
- set_base_uri(self, base_uri)
Get the base URI of documents loaded using this PyDocumentBuilder when no other URI is available.
Args:
base_uri (str): the base output URI
- set_schema_validator(...)
- Set the source document for the transformation.
Args:
**kwds: Keyword argument can only be one of the following: file_name|xdm_node
Raises:
Exception: Exception is raised if keyword argument is not one of file_name or node.
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- base_uri
- base_uri(self)
Base uri Property. Get the Base URI for the node, that is, the URI used for resolving a relative URI contained in the node.
This will be the same as the System ID unless xml:base has been used. Where the node does not have a base URI of its own,
the base URI of its parent node is returned.
Returns:
str: String value of the base uri for this node. This may be NULL if the base URI is unknown, including the case
where the node has no parent.
- dtd_validation
- bool: Ask whether DTD validation is to be applied to documents loaded using this PyDocumentBuilder
- line_numbering
- bool: true if line numbering is enabled
|
class PySaxonProcessor(builtins.object) |
|
An SaxonProcessor acts as a factory for generating XQuery, XPath, Schema and XSLT compilers.
This class is itself the context that needs to be managed (i.e. allocation & release)
Example:
with saxonc.PySaxonProcessor(license=False) as proc:
print("Test SaxonC on Python")
print(proc.version)
xdmAtomicval = proc.make_boolean_value(False)
xslt30proc = proc.new_xslt30_processor() |
|
Methods defined here:
- __enter__(...)
- enter method for use with the keyword 'with' context
- __exit__(...)
- The exit method for the context PySaxonProcessor. Here we release the Jet VM resources.
If we have more than one live PySaxonProcessor object the release() method has no effect.
- __reduce__ = __reduce_cython__(...)
- __setstate__ = __setstate_cython__(...)
- clear_configuration_properties(...)
- clear_configuration_properties(self)
Clear the configurations properties in use by the processor
- exception_clear(...)
- exception_clear(self)
Clear any exception thrown internally in SaxonC.
- get_string_value(...)
- get_string_value(self, PyXdmItem item)
Create an QName Xdm value from string representation in clark notation
Args:
str_ (str): The value given in a string form in clark notation. {uri}local
Returns:
PyAtomicValue: The corresonding value
- make_array(...)
- make_array(self, list_values)
Make an XdmArray whose members are from a list of XdmValues
Args:
list_values (list): List of XdmValues
Returns:
PyAXdmArray: The corresponding value
- make_atomic_value(...)
- make_atomic_value(self, value_type, value)
Create an QName Xdm value from string representation in clark notation
Args:
str_ (str): The value given in a string form in clark notation. {uri}local
Returns:
PyAtomicValue: The corresponding value
- make_boolean_value(...)
- make_boolean_value(self, value)
Factory method: makes a XdmAtomicValue representing a boolean Value
Args:
value (boolean): True or False, to determine which boolean value is required
Returns:
PyAtomicValue: The corresonding XdmValue
- make_double_value(...)
- make_double_value(self, value)
Factory method: makes a double value
Args:
value (double): The supplied primitive double value
Returns:
PyXdmAtomicValue: The corresponding Xdm Value
- make_float_value(...)
- make_float_value(self, value)
Factory method: makes a float value
Args:
value (float): The supplied primitive float value
Returns:
PyXdmAtomicValue: The corresponding Xdm Value
- make_integer_value(...)
- make_integer_value(self, value)
Factory method: makes either an Int64Value or a BigIntegerValue depending on the value supplied
Args:
value (int): The supplied primitive integer value
Returns:
PyXdmAtomicValue: The corresponding Xdm value which is a BigIntegerValue or Int64Value as appropriate
- make_long_value(...)
- make_long_value(self, value)
Factory method: makes either an Int64Value or a BigIntegerValue depending on the value supplied
Args:
value (long): The supplied primitive long value
Returns:
PyXdmAtomicValue: The corresponding Xdm Value
- make_map(...)
- make_map(self, dict dataMap)
Make an XdmMap whose members are from a dict type. Members are key, value pair (XdmAtomicValue, XdmValue).
The factory method create_xdm_dict(proc, mmap) can be used to create pairs of type (XdmAtomicValue, XdmValue) from primitive types, which
then can be used as input to this function make_map.
Args:
dataMap (dict): Dictionary of (XdmAtomicValue, XdmValue) pairs
Returns:
PyAXdmAMap: The corresponding value
- make_map2(...)
- make_map2(self, dict_dataMap)
Make an XdmMap whose members are from a dict type. Members are key, value pair (str, XdmValue).
The factory method create_xdm_dict(proc, mmap) can be used to create pairs of type (str, XdmValue) from primitive types, which
then can be used as input to this function make_map.
Args:
dataMap (dict): Dictionary of (str, XdmValue) pairs
Returns:
PyAXdmMap: The corresponding value
- make_qname_value(...)
- make_qname_value(self, str_)
Create an QName Xdm value from string representation in clark notation
Args:
str_ (str): The value given in a string form in clark notation. {uri}local
Returns:
PyAtomicValue: The corresonding value
- make_string_value(...)
- make_string_value(self, str_)
Factory method. Unlike the constructor, this avoids creating a new StringValue in the case
of a zero-length string (and potentially other strings, in future)
Args:
str_ (str): the String value. NULL is taken as equivalent to "".
Returns:
PyXdmAtomicValue: The corresponding Xdm StringValue
- new_document_builder(...)
- new_document_builder(self)
Create an PyDocumentBuilder. A PyDocumentBuilder holds properties controlling how a Saxon document tree should be built, and
provides methods to invoke the tree construction.
Returns:
PyDocumentBuilder: a newly created PyDocumentProcessor
- new_schema_validator(...)
- new_schema_validator(self)
Create a PySchemaValidator which can be used to validate instance documents against the schema held by this
Returns:
PySchemaValidator: a newly created PySchemaValidator
- new_xpath_processor(...)
- new_xpath_processor(self)
Create an PyXPathProcessor. A PyXPathProcessor is used to compile and execute XPath expressions.
Returns:
PyXPathProcessor: a newly created XPathProcessor
- new_xquery_processor(...)
- new_xquery_processor(self)
Create an PyXqueryProcessor. A PyXQueryProcessor is used to compile and execute XQuery queries.
Returns:
PyXQueryProcessor: a newly created PyXQueryProcessor
- new_xslt30_processor(...)
- new_xslt30_processor(self)
Create an PyXslt30Processor. A PyXslt30Processor is used to compile and execute XSLT 3.0 stylesheets.
Returns:
PyXslt30Processor: a newly created PyXslt30Processor
- parse_xml(...)
- parse_xml(self, **kwds)
Parse a lexical representation, source file or uri of the source document and return it as an Xdm Node
Args:
**kwds : The possible keyword arguments must be one of the follow (xml_file_name|xml_text|xml_uri)
Returns:
PyXdmNode: The Xdm Node representation of the XML document
Raises:
Exception: Error if the keyword argument is not one of xml_file_name|xml_text|xml_uri.
- set_catalog(...)
- set_ctalog(self, name, value)
Set the XML catalog to be used in Saxon
Args:
file_name (str): The file name for the XML catalog
is_tracing (bool):Customize the resolver to write messages to the Saxon logging destination
- set_configuration_property(...)
- set_configuration_property(self, name, value)
Set configuration property specific to the processor in use.
Properties set here are common across all processors.
Args:
name (str): The name of the property
value (str): The value of the property
Example:
'l': 'on' or 'off' - to enable the line number
- set_cwd(...)
- set_resources_directory(...)
- Property to set or get resources directory
:str: A string of the resources directory which Saxon will use
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- attach_current_thread
- cwd
- cwd Property represents the current working directory
:str: Get or set the current working directory
- detach_current_thread
- error_message
- error_message(self)
The PySaxonProcessor may have a number of errors reported against it. Get the error message if there are any errors
Returns:
str: The message of the exception. Return None if the exception does not exist.
- exception_occurred
- exception_occurred(self)
Property to check if an exception has occurred internally within SaxonC
Returns:
boolean: True or False if an exception has been reported internally in SaxonC
- is_schema_aware
- is_schema_aware(self)
Property to check if the processor is Schema aware. A licensed Saxon-EE/C product is schema aware
:bool: Indicate if the processor is schema aware, True or False otherwise
- resources_directory
- version
- Get the Saxon Version.
Getter:
str: The Saxon version
|
class PySchemaValidator(builtins.object) |
|
An PySchemaValidator represents factory for validating instance documents against a schema. |
|
Methods defined here:
- __reduce__ = __reduce_cython__(...)
- __setstate__ = __setstate_cython__(...)
- clear_parameters(...)
- clear_parameter(self)
Clear all parameters set on the processor
- clear_properties(...)
- clear_parameter(self)
Clear all properties set on the processor
- exception_clear(...)
- exception_clear(self)
Clear any exception thrown
- export_schema(...)
- export_schema(self, file_name)
Export a precompiled Schema Component Model containing all the components (except built-in components) that have been loaded
Args:
file_name (str):The file name that will be used for thje saved SCM
- get_error_code(...)
- get_error_code(self)
A transformation may have a number of errors reported against it. Get the error code if there was an error.
Args:
index (int): The i'th exception
Returns:
str: The error code associated with the exception thrown. Return None if the exception does not exist.
- get_error_message(...)
- error_message(self)
A transformation may have a number of errors reported against it. Get the ith error message if there are any errors
Args:
index (int): The i'th exception
Returns:
str: The message of the exception. Return None if the exception does not exist.
- register_schema(...)
- Register schema given as file name or schema text. (xsd_text|xsd_file)
Args:
**kwds: Keyword argument options only one of 'xsd_text' or 'xsd_file'
- remove_parameter(...)
- remove_parameter(self, name)
Remove the parameter given by name from the PySchemaValidator. The parameter will not have any affect on the SchemaValidator if it has not yet been executed
Args:
name (str): The name of the schema parameter
Returns:
bool: True if the removal of the parameter has been successful, False otherwise.
- set_cwd(...)
- set_cwd(self, cwd)
Set the current working directory.
Args:
cwd (str): current working directory
- set_lax(...)
- set_lax(self, lax)
The validation mode may be either strict or lax.
The default is strict; this method may be called to indicate that lax validation is required. With strict validation,
validation fails if no element declaration can be located for the outermost element. With lax validation,
the absence of an element declaration results in the content being considered valid.
Args:
lax (boolean): lax True if validation is to be lax, False if it is to be strict
- set_output_file(...)
- set_output_file(self, output_file)
Set the name of the output file that will be used by the validator.
Args:
output_file (str):The output file name for use by the validator
- set_parameter(...)
- set_parameter(self, name, PyXdmValue value)
Set the value of the parameter for the Schema validator
Args:
name (str): the name of the schema parameter, as a string. For namespaced parameter use the JAXP solution i.e. "{uri}name
value (PyXdmValue): the value of the parameter, or None to clear a previously set value
- set_property(...)
- set_property(self, name, value)
Set a property specific to the processor in use.
Args:
name (str): The name of the property
value (str): The value of the property
Example:
PySchemaValidator: set serialization properties (names start with '!' i.e. name "!method" -> "xml")
'o':outfile name,
'dtd': Possible values 'on' or 'off' to set DTD validation,
'resources': directory to find Saxon data files,
's': source as file name,
'string': Set the source as xml string for validation. Parsing will take place in the validate method
'report-node': Boolean flag for validation reporting feature. Error validation failures are represented in an XML
document and returned as an PyXdmNode object
'report-file': Specifcy value as a file name string. This will switch on the validation reporting feature, which will be
saved to the file in an XML format
'verbose': boolean value which sets the verbose mode to the output in the terminal. Default is 'on'
'element-type': Set the name of the required type of the top-lelvel element of the doucment to be validated.
The string should be in the Clark notation {uri}local
'lax': Boolean to set the validation mode to strict (False) or lax ('True')
- set_source_node(...)
- set_source_node(self, source)
Set the source as an PyXdmNode object that will be validated
Args:
source (PyXdmNode) :
- validate(...)
- validate(self, **kwds)
Validate an instance document by a registered schema.
Args:
**kwds: The possible keyword arguments must be one of the follow (file_name|xml_text|xdm_node).
The source file to be validated. Allow None when source document is supplied using the set_source method
- validate_to_node(...)
- validate_to_node(self, **kwds)
Validate an instance document by a registered schema.
Args:
**kwds: The possible keyword arguments must be one of the follow (file_name|xml_text|xdm_node).
The source file to be validated. Allow None when source document is supplied using the set_source method
Returns:
PyXdmNode: The validated document returned to the calling program as an PyXdmNode
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- exception_occurred
- exception_occurred(self)
Property to check if an exception has occurred internally within SaxonC
Returns:
boolean: True or False if an exception has been reported internally in SaxonC
- validation_report
- validation_report
The validation report Property
:PyXdmNode: The Validation report result from the Schema validator
|
class PyXPathProcessor(builtins.object) |
|
An XPathProcessor represents factory to compile, load and execute the XPath query. |
|
Methods defined here:
- __reduce__ = __reduce_cython__(...)
- __setstate__ = __setstate_cython__(...)
- clear_parameters(...)
- clear_parameter(self)
Clear all parameters set on the processor
- clear_properties(...)
- clear_parameter(self)
Clear all properties set on the processor
- declare_namespace(...)
- declare_namespace(self, prefix, uri)
Declare a namespace binding as part of the static context for XPath expressions compiled using this compiler
Args:
prefix (str): The namespace prefix. If the value is a zero-length string, this method sets the default namespace
for elements and types.
uri (uri) : The namespace URI. It is possible to specify a zero-length string to "undeclare" a namespace;
in this case the prefix will not be available for use, except in the case where the prefix is also a
zero length string, in which case the absence of a prefix implies that the name is in no namespace.
- declare_variable(...)
- declare_variable(self, name)
Declare variable name
Args:
prefix (str): The variable name to declare
- effective_boolean_value(...)
- effective_boolean_value(self, xpath_str)
Evaluate the XPath expression, returning the effective boolean value of the result.
Args:
xpath_str (str): Supplied as a string
Returns:
boolean: The result is a boolean value.
- evaluate(...)
- evaluate(self, xpath_str)
Args:
xpath_str (str): The XPath query suplied as a string
Returns:
PyXdmValue:
- evaluate_single(...)
- evaluate_single(self, xpath_str)
Args:
xpath_str (str): The XPath query supplied as a string
Returns:
PyXdmItem: A single Xdm Item is returned. return None if the expression returns an empty sequence.
If the expression returns a sequence of more than one item, any items after the first are ignored.
- exception_clear(...)
- exception_clear(self)
Clear any exception thrown
- import_schema_namespace(...)
- import_schema_namespace(self, uri)
Import a schema namespace
Args:
uri (str): The schema namespace to be imported. To import declarations in a no-namespace schema, supply a zero-length string.
- remove_parameter(...)
- remove_parameter(self, name)
Remove the parameter given by name from the PyXPathProcessor. The parameter will not have any affect on the XPath if it has not yet been executed
Args:
name (str): The name of the XPath parameter
Returns:
bool: True if the removal of the parameter has been successful, False otherwise.
- set_backwards_compatible(...)
- set_backwards_compatible(self, option)
Say whether XPath 1.0 backwards compatibility mode is to be used
Args:
option (bool): true if XPath 1.0 backwards compatibility is to be enabled, false if it is to be disabled.
- set_caching(...)
- set_caching(self, is_caching)
Say whether the compiler should maintain a cache of compiled expressions.
Args:
is_caching (bool): if set to true, caching of compiled expressions is enabled.
If set to false, any existing cache is cleared, and future compiled expressions
will not be cached until caching is re-enabled. The cache is also cleared
(but without disabling future caching)
if any method is called that changes the static context for compiling
expressions, for example declareVariable(QName) or
declareNamespace(String, String).
- set_context(...)
- set_context(self, **kwds)
Set the context for the XPath query
Args:
**kwds : Possible keyword argument file_name (str) or xdm_item (PyXdmItem)
- set_cwd(...)
- set_cwd(self, cwd)
Set the current working directory.
Args:
cwd (str): current working directory
- set_parameter(...)
- set_parameter(self, name, PyXdmValue value)
Set the value of a XPath parameter
Args:
name (str): the name of the XPath parameter, as a string. For namespaced parameter use the JAXP solution i.e. "{uri}name
value (PyXdmValue): the value of the query parameter, or None to clear a previously set value
- set_property(...)
- set_property(self, name, value)
Set a property specific to the processor in use.
Args:
name (str): The name of the property
value (str): The value of the property
Example:
PyXPathProcessor: set serialization properties (names start with '!' i.e. name "!method" -> "xml")
'resources': directory to find Saxon data files,
's': source as file name,
'extc': REgister native library to be used with extension functions
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- error_code
- error_code(self)
A transformation may have a number of errors reported against it. This property returns the error code if there are any errors
Returns:
str: The error code associated with the exception. Return None if the exception does not exist.
- error_message
- error_message(self)
A transformation may have a number of errors reported against it. This property returns the error message if there are any errors
Returns:
str: The message of the exception. Return None if the exception does not exist.
- exception_occurred
- exception_occurred(self)
Check if an exception has occurred internally within SaxonC
Returns:
boolean: True or False if an exception has been reported internally in SaxonC
|
class PyXQueryProcessor(builtins.object) |
|
An PyXQueryProcessor object represents factory to compile, load and execute queries. |
|
Methods defined here:
- __reduce__ = __reduce_cython__(...)
- __setstate__ = __setstate_cython__(...)
- check_exception(...)
- check_exception(self)
Check for exception thrown and get message of the exception.
Returns:
str: Returns the exception message if thrown otherwise return None
- clear_parameters(...)
- clear_parameter(self)
Clear all parameters set on the processor
- clear_properties(...)
- clear_parameter(self)
Clear all properties set on the processor
- declare_namespace(...)
- declare_namespace(self, prefix, uri)
Declare a namespace binding part of the static context for queries compiled using this.
This binding may be overridden by a binding that appears in the query prolog.
The namespace binding will form part of the static context of the query, but it will
not be copied into result trees unless the prefix is actually used in an element or attribute name.
Args:
prefix (str): The namespace prefix. If the value is a zero-length string, this method sets the default namespace for elements and types.
uri (uri) : The namespace URI. It is possible to specify a zero-length string to "undeclare" a namespace; in this case the prefix will not be available for use,
except in the case where the prefix is also a zero length string, in which case the absence of a prefix implies that the name is in no namespace.
- exception_clear(...)
- exception_clear(self)
Clear any exception thrown
- remove_parameter(...)
- remove_parameter(self, name)
Remove the parameter given by name from the PyXQueryProcessor. The parameter will not have any affect on the query if it has not yet been executed
Args:
name (str): The name of the query parameter
Returns:
bool: True if the removal of the parameter has been successful, False otherwise.
- run_query_to_file(...)
- run_query_to_file(self, **kwds)
Execute query with the result saved to file
Args:
**kwds: Keyword arguments with the possible options input_file_name (str) or input_xdm_item (PyXdmItem). The Query can be
supplied with the arguments 'query_file' or 'query_text', which are of type str. The name of the output file is
specified as the argument output_file_name.
- run_query_to_string(...)
- run_query_to_string(self, **kwds)
Execute query and output result as a string
Args:
**kwds: Keyword arguments with the possible options input_file_name (str) or input_xdm_item (PyXdmItem). Possible to supply
query with the arguments 'query_file' or 'query_text', which are of type str.
Returns:
str: Output result as a string
- run_query_to_value(...)
- run_query_to_value(self, **kwds)
Execute query and output result as an PyXdmValue object
Args:
**kwds: Keyword arguments with the possible options input_file_name (str) or input_xdm_item (PyXdmItem). Possible to supply
query with the arguments 'query_file' or 'query_text', which are of type str.
Returns:
PyXdmValue: Output result as an PyXdmValue
- set_context(...)
- set_context(self, **kwds)
Set the initial context for the query
Args:
**kwds : Possible keyword argument file_name (str) or xdm_item (PyXdmItem)
- set_cwd(...)
- set_cwd(self, cwd)
Set the current working directory.
Args:
cwd (str): current working directory
- set_output_file(...)
- set_output_file(self, output_file)
Set the output file where the result is sent
Args:
output_file (str): Name of the output file
- set_parameter(...)
- set_parameter(self, name, PyXdmValue value)
Set the value of a query parameter
Args:
name (str): the name of the stylesheet parameter, as a string. For namespaced parameter use the JAXP solution i.e. "{uri}name
value (PyXdmValue): the value of the query parameter, or None to clear a previously set value
- set_property(...)
- set_property(self, name, value)
Set a property specific to the processor in use.
Args:
name (str): The name of the property
value (str): The value of the property
Example:
PyXQueryProcessor: set serialization properties (names start with '!' i.e. name "!method" -> "xml")
'o':outfile name,
'dtd': Possible values 'on' or 'off' to set DTD validation,
'resources': directory to find Saxon data files,
's': source as file name,
- set_query_base_uri(...)
- set_query_base_uri(self, base_uri)
Set the static base query for the query
Args:
base_uri (str): The static base URI; or None to indicate that no base URI is available
- set_query_content(...)
- set_query_content(self)
Set the query to be executed as a string
Args:
content (str): The query content suplied as a string
- set_query_file(...)
- set_query_file(self, file_name)
Set the query to be executed as a file
Args:
file_name (str): The file name for the query
- set_updating(...)
- set_updating(self, updating)
Say whether the query is allowed to be updating. XQuery update syntax will be rejected during query compilation unless this
flag is set. XQuery Update is supported only under Saxon-EE/C.
Args:
updating (bool): true if the query is allowed to use the XQuery Update facility (requires Saxon-EE/C). If set to false,
the query must not be an updating query. If set to true, it may be either an updating or a non-updating query.
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- error_code
- error_code(self)
A transformation may have a number of errors reported against it. This property returns error code if there are any errors
Returns:
str: The error code associated with the exception. Return None if the exception does not exist.
- error_message
- error_message(self)
A transformation may have a number of errors reported against it. This property returns error message if there are any errors
Returns:
str: The message of the exception. Return None if the exception does not exist.
- exception_occurred
- exception_occurred(self)
Property to check for pending exceptions without creating a local reference to the exception object
Returns:
boolean: True when there is a pending exception; otherwise return False
|
class PyXdmArray(PyXdmFunctionItem) |
|
The class PyXdmArray represents an array in the XDM data model. An array is a list of zero or more members, each of which
is an arbitrary XDM value. The array itself is an XDM item. |
|
- Method resolution order:
- PyXdmArray
- PyXdmFunctionItem
- PyXdmItem
- PyXdmValue
- builtins.object
Methods defined here:
- __iter__(...)
- Returns the Iterator object of PyXdmArray
- __reduce__ = __reduce_cython__(...)
- __repr__(self, /)
- Return repr(self).
- __setstate__ = __setstate_cython__(...)
- __str__(self, /)
- Return str(self).
- add_member(...)
- add_member(self, value)
Create a new array in which one member is replaced with a new value.
Args:
value (PyXdmValue): the new member as PYXdmValue or any of its subclasses
Returns:
PyXdmArray: a new array, one item longer than the original
- as_list(...)
- as_list(self)
Get the members of the array in the form of a list.
Returns:
list: list of the members of this array.
- concat(...)
- concat(self, PyXdmArray value)
Concatenate another array to this array
Args:
value (PyXdmArray): the other array
Returns:
PyXdmArray: a new array, containing the members of this array followed by the members of the other array
- get(...)
- get(self, int n)
Get the n'th member in the array, counting from zero
Args:
n (int): the member that is required, counting the first member in the array as member zero
Returns:
PyXdmValue: the n'th member in the sequence making up the array, counting from zero
- put(...)
- put(self, int n, PyXdmValue value)
Create a new array in which one member is replaced with a new value.
Args:
n (int): n the position of the member that is to be replaced, counting the first member in the array as member zero
value (PyXdmValue): the new value for this member
Returns:
PyXdmArray: a new array, the same length as the original, with one member replaced by a new value
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- arity
- arity(self)
Get the arity of the function
Returns:
int: the arity of the function, that is, the number of arguments in the function's signature
- array_length
- Get the number of members in the array
Returns:
int: the number of members in the array. (Note that the size() method returns 1 (one),
because an XDM array is an item.)
- string_value
- Property which returns the string value of the PyXdmArray
Returns:
str: String value of the Xdm object
Methods inherited from PyXdmFunctionItem:
- call(...)
- call(self, list args)
Call the function
:param args: arguments the values to be supplied as arguments to the function. The "function
conversion rules" will be applied to con
:return: PyXdmValue - the result of calling the function
- get_system_function(...)
- Get a system function. This can be any function defined in XPath 3.1 functions and operators,
including functions in the math, map, and array namespaces. It can also be a Saxon extension
function, provided a licensed Processor is used.
:return:
Data descriptors inherited from PyXdmFunctionItem:
- name
- name(self)
Get the name of the function
Methods inherited from PyXdmItem:
- get_atomic_value(...)
- get_atomic_value(self)
Get the subclass PyXdmAtomicValue for this PyXdmItem object current object if it is an atomic value
Returns:
PyXdmAtomicValue: Subclass this object to PyXdmAtomicValue or error
- get_map_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
- get_node_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
Data descriptors inherited from PyXdmItem:
- head
- head(self)
Property to get the first item in the sequence. This would be the PyXdmItem itself as there is only one item in the sequence
Returns:
PyXdmItem: The PyXdmItem or None if the sequence is empty
- is_array
- is_array(self)
Property to check if the current PyXdmItem is an XdmArray value
Returns:
bool: Check for array value
- is_atomic
- is_atomic(self)
Property to check if the current PyXdmItem is an atomic value
Returns:
bool: Check of is atomic value
- is_function
- is_atomic(self)
Property to check if the current PyXdmItem is a function value
Returns:
bool: Check of is atomic value
- is_map
- is_map(self)
Property to check if the current PyXdmItem is a map value
Returns:
bool: Check for map value
- is_node
- is_atomic(self)
Property to check if the current PyXdmItem is a node value
Returns:
bool: Check for node value
Methods inherited from PyXdmValue:
- add_xdm_item(...)
- add_xdm_tem(self, PyXdmItem value)
Add PyXdmItem to the Xdm sequence
Args:
value (PyXdmItem): The PyXdmItem object
- item_at(...)
- item_at(self, index)
Get the n'th item in the value, counting from zero.
Args:
index (int): the index of the item required. Counting from zero
Returns:
PyXdmItem: Get the item indicated at the index. This could be PyXdmNode or PyXdmAtomicValue object. If the item does not exist return None.
Data descriptors inherited from PyXdmValue:
- size
- size(self)
Property - Get the number of items in the sequence
Returns:
int: The count of items in the sequence
|
class PyXdmAtomicValue(PyXdmItem) |
|
The class PyXdmAtomicValue represents an item in an Xath sequence that is an atomic value. The value may belong to any of the
19 primitive types defined in XML Schema, or to a type derived from these primitive types, or the XPath type xs:untypedAtomic. |
|
- Method resolution order:
- PyXdmAtomicValue
- PyXdmItem
- PyXdmValue
- builtins.object
Methods defined here:
- __eq__(self, value, /)
- Return self==value.
- __ge__(self, value, /)
- Return self>=value.
- __gt__(self, value, /)
- Return self>value.
- __hash__(self, /)
- Return hash(self).
- __int__(self, /)
- int(self)
- __le__(self, value, /)
- Return self<=value.
- __lt__(self, value, /)
- Return self<value.
- __ne__(self, value, /)
- Return self!=value.
- __reduce__ = __reduce_cython__(...)
- __repr__(...)
- ___repr__
- __setstate__ = __setstate_cython__(...)
- __str__(...)
- __str__(self)
The string value of the node as defined in the XPath data model
Returns:
str: String value of this node
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- boolean_value
- Property which returns the boolean value of the PyXdmAtomicValue
Returns:
bool: boolean value.
- double_value
- Property which is returns the double value of the PyXdmAtomicValue if it can be converted.
Returns:
double: Double value of the Xdm object
- head
- head(self)
Property to get the first item in the sequence. This would be the PyXdmAtomicValue itself as there is only one item in the sequence
Returns:
PyXdmAtomicValue: The PyXdmAtomic or None if the sequence is empty
- integer_value
- Property which is returns the int value of the PyXdmAtomicValue if it can be converted.
Returns:
int: Int value of the Xdm object
- primitive_type_name
- get_primitive_type_name()
Property - Get the primitive type name of the PyXdmAtomicValue
Returns:
str: String of the primitive type name
- string_value
- Property which returns the string value of the PyXdmAtomicValue
Returns:
str: String value of the Xdm object
Methods inherited from PyXdmItem:
- get_atomic_value(...)
- get_atomic_value(self)
Get the subclass PyXdmAtomicValue for this PyXdmItem object current object if it is an atomic value
Returns:
PyXdmAtomicValue: Subclass this object to PyXdmAtomicValue or error
- get_map_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
- get_node_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
Data descriptors inherited from PyXdmItem:
- is_array
- is_array(self)
Property to check if the current PyXdmItem is an XdmArray value
Returns:
bool: Check for array value
- is_atomic
- is_atomic(self)
Property to check if the current PyXdmItem is an atomic value
Returns:
bool: Check of is atomic value
- is_function
- is_atomic(self)
Property to check if the current PyXdmItem is a function value
Returns:
bool: Check of is atomic value
- is_map
- is_map(self)
Property to check if the current PyXdmItem is a map value
Returns:
bool: Check for map value
- is_node
- is_atomic(self)
Property to check if the current PyXdmItem is a node value
Returns:
bool: Check for node value
Methods inherited from PyXdmValue:
- __iter__(...)
- Returns the Iterator object of PyXdmValue
- add_xdm_item(...)
- add_xdm_tem(self, PyXdmItem value)
Add PyXdmItem to the Xdm sequence
Args:
value (PyXdmItem): The PyXdmItem object
- item_at(...)
- item_at(self, index)
Get the n'th item in the value, counting from zero.
Args:
index (int): the index of the item required. Counting from zero
Returns:
PyXdmItem: Get the item indicated at the index. This could be PyXdmNode or PyXdmAtomicValue object. If the item does not exist return None.
Data descriptors inherited from PyXdmValue:
- size
- size(self)
Property - Get the number of items in the sequence
Returns:
int: The count of items in the sequence
|
class PyXdmFunctionItem(PyXdmItem) |
|
The class PyXdmFunctionItem represents a function item |
|
- Method resolution order:
- PyXdmFunctionItem
- PyXdmItem
- PyXdmValue
- builtins.object
Methods defined here:
- __reduce__ = __reduce_cython__(...)
- __repr__(self, /)
- Return repr(self).
- __setstate__ = __setstate_cython__(...)
- __str__(self, /)
- Return str(self).
- call(...)
- call(self, list args)
Call the function
:param args: arguments the values to be supplied as arguments to the function. The "function
conversion rules" will be applied to con
:return: PyXdmValue - the result of calling the function
- get_system_function(...)
- Get a system function. This can be any function defined in XPath 3.1 functions and operators,
including functions in the math, map, and array namespaces. It can also be a Saxon extension
function, provided a licensed Processor is used.
:return:
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- arity
- arity(self)
Property - Get the arity of the function
:returns:
int: The arity of the function, that is, the number of arguments in the function's signature
- name
- name(self)
Get the name of the function
- string_value
- Property which returns the string value of the PyXdmFunctionItem
Returns:
str: String value of the Xdm object
Methods inherited from PyXdmItem:
- get_atomic_value(...)
- get_atomic_value(self)
Get the subclass PyXdmAtomicValue for this PyXdmItem object current object if it is an atomic value
Returns:
PyXdmAtomicValue: Subclass this object to PyXdmAtomicValue or error
- get_map_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
- get_node_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
Data descriptors inherited from PyXdmItem:
- head
- head(self)
Property to get the first item in the sequence. This would be the PyXdmItem itself as there is only one item in the sequence
Returns:
PyXdmItem: The PyXdmItem or None if the sequence is empty
- is_array
- is_array(self)
Property to check if the current PyXdmItem is an XdmArray value
Returns:
bool: Check for array value
- is_atomic
- is_atomic(self)
Property to check if the current PyXdmItem is an atomic value
Returns:
bool: Check of is atomic value
- is_function
- is_atomic(self)
Property to check if the current PyXdmItem is a function value
Returns:
bool: Check of is atomic value
- is_map
- is_map(self)
Property to check if the current PyXdmItem is a map value
Returns:
bool: Check for map value
- is_node
- is_atomic(self)
Property to check if the current PyXdmItem is a node value
Returns:
bool: Check for node value
Methods inherited from PyXdmValue:
- __iter__(...)
- Returns the Iterator object of PyXdmValue
- add_xdm_item(...)
- add_xdm_tem(self, PyXdmItem value)
Add PyXdmItem to the Xdm sequence
Args:
value (PyXdmItem): The PyXdmItem object
- item_at(...)
- item_at(self, index)
Get the n'th item in the value, counting from zero.
Args:
index (int): the index of the item required. Counting from zero
Returns:
PyXdmItem: Get the item indicated at the index. This could be PyXdmNode or PyXdmAtomicValue object. If the item does not exist return None.
Data descriptors inherited from PyXdmValue:
- size
- size(self)
Property - Get the number of items in the sequence
Returns:
int: The count of items in the sequence
|
class PyXdmItem(PyXdmValue) |
|
The class XdmItem represents an item in a sequence, as defined by the XDM data model.
An item is either an atomic value or a node. |
|
- Method resolution order:
- PyXdmItem
- PyXdmValue
- builtins.object
Methods defined here:
- __reduce__ = __reduce_cython__(...)
- __repr__(self, /)
- Return repr(self).
- __setstate__ = __setstate_cython__(...)
- __str__(self, /)
- Return str(self).
- get_atomic_value(...)
- get_atomic_value(self)
Get the subclass PyXdmAtomicValue for this PyXdmItem object current object if it is an atomic value
Returns:
PyXdmAtomicValue: Subclass this object to PyXdmAtomicValue or error
- get_map_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
- get_node_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- head
- head(self)
Property to get the first item in the sequence. This would be the PyXdmItem itself as there is only one item in the sequence
Returns:
PyXdmItem: The PyXdmItem or None if the sequence is empty
- is_array
- is_array(self)
Property to check if the current PyXdmItem is an XdmArray value
Returns:
bool: Check for array value
- is_atomic
- is_atomic(self)
Property to check if the current PyXdmItem is an atomic value
Returns:
bool: Check of is atomic value
- is_function
- is_atomic(self)
Property to check if the current PyXdmItem is a function value
Returns:
bool: Check of is atomic value
- is_map
- is_map(self)
Property to check if the current PyXdmItem is a map value
Returns:
bool: Check for map value
- is_node
- is_atomic(self)
Property to check if the current PyXdmItem is a node value
Returns:
bool: Check for node value
- string_value
- string_value(self)
Property to get the the string value of the XdmItem
Methods inherited from PyXdmValue:
- __iter__(...)
- Returns the Iterator object of PyXdmValue
- add_xdm_item(...)
- add_xdm_tem(self, PyXdmItem value)
Add PyXdmItem to the Xdm sequence
Args:
value (PyXdmItem): The PyXdmItem object
- item_at(...)
- item_at(self, index)
Get the n'th item in the value, counting from zero.
Args:
index (int): the index of the item required. Counting from zero
Returns:
PyXdmItem: Get the item indicated at the index. This could be PyXdmNode or PyXdmAtomicValue object. If the item does not exist return None.
Data descriptors inherited from PyXdmValue:
- size
- size(self)
Property - Get the number of items in the sequence
Returns:
int: The count of items in the sequence
|
class PyXdmMap(PyXdmFunctionItem) |
|
The class PyXdmMap represents a map in the XDM data model. A map is a list of zero or more entries, each of which
is a pair comprising a key (which is an atomic value) and a value (which is an arbitrary value).
The map itself is an XDM item. <p>An XdmMap is immutable.</p> |
|
- Method resolution order:
- PyXdmMap
- PyXdmFunctionItem
- PyXdmItem
- PyXdmValue
- builtins.object
Methods defined here:
- __iter__(...)
- Returns the Iterator object of PyXdmMap
- __reduce__ = __reduce_cython__(...)
- __repr__(self, /)
- Return repr(self).
- __setstate__ = __setstate_cython__(...)
- __str__(self, /)
- Return str(self).
- contains_key(...)
- contains_key(self, PYXdmAtomicValue key)
Returns true if this map contains a mapping for the specified key.
Args:
key (PyXdmAtomicValue) - key key whose presence in this map is to be tested
Returns:
true if this map contains a mapping for the specified key
- get(...)
- get(self, key)
Returns the value to which the specified key is mapped, or NULL if this map contains no mapping for the key.
Args:
key - the key whose associated value is to be returned. The key supports the following types XdmAtomicValue, str, int and float
Returns:
PyXdmValue - the value to which the specified key is mapped, or NULL if this map contains no mapping for the key
- keys(...)
- keys(self)
Keys in the XdmMap
:return: list of PyXdmAtomicValues
- put(...)
- put(self, PYXdmAtomicValue key, PyXdmValue value)
Create a new map containing an additional (key, value) pair. If there is an existing entry with the same key, it is removed
Args:
key - The key to be removed given as an XdmAtomicValue
Returns:
PyXdmMap - a new map containing the additional entry. The original map is unchanged.
- remove(...)
- remove(self, PYXdmAtomicValue key)
Create a new map in which the entry for a given key has been removed.
Args:
key - The key to be removed given as an XdmAtomicValue
Returns:
PyXdmMap - a map without the specified entry. The original map is unchanged.
- values(...)
- values(self)
:return:
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- isEmpty
- isEmpty(self, PYXdmAtomicValue key)
Returns true if this map contains no key-value mappings.
Returns:
true if this map contains no key-value mappings
- map_size
- map_size(self)
Get the number of entries in the map
Returns:
the number of entries in the map. (Note that the <code>size()</code> method returns 1 (one), because an XDM map is an item.)
- string_value
- Property which returns the string value of the PyXdmMap
Returns:
str: String value of the Xdm object
Methods inherited from PyXdmFunctionItem:
- call(...)
- call(self, list args)
Call the function
:param args: arguments the values to be supplied as arguments to the function. The "function
conversion rules" will be applied to con
:return: PyXdmValue - the result of calling the function
- get_system_function(...)
- Get a system function. This can be any function defined in XPath 3.1 functions and operators,
including functions in the math, map, and array namespaces. It can also be a Saxon extension
function, provided a licensed Processor is used.
:return:
Data descriptors inherited from PyXdmFunctionItem:
- arity
- arity(self)
Property - Get the arity of the function
:returns:
int: The arity of the function, that is, the number of arguments in the function's signature
- name
- name(self)
Get the name of the function
Methods inherited from PyXdmItem:
- get_atomic_value(...)
- get_atomic_value(self)
Get the subclass PyXdmAtomicValue for this PyXdmItem object current object if it is an atomic value
Returns:
PyXdmAtomicValue: Subclass this object to PyXdmAtomicValue or error
- get_map_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
- get_node_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
Data descriptors inherited from PyXdmItem:
- head
- head(self)
Property to get the first item in the sequence. This would be the PyXdmItem itself as there is only one item in the sequence
Returns:
PyXdmItem: The PyXdmItem or None if the sequence is empty
- is_array
- is_array(self)
Property to check if the current PyXdmItem is an XdmArray value
Returns:
bool: Check for array value
- is_atomic
- is_atomic(self)
Property to check if the current PyXdmItem is an atomic value
Returns:
bool: Check of is atomic value
- is_function
- is_atomic(self)
Property to check if the current PyXdmItem is a function value
Returns:
bool: Check of is atomic value
- is_map
- is_map(self)
Property to check if the current PyXdmItem is a map value
Returns:
bool: Check for map value
- is_node
- is_atomic(self)
Property to check if the current PyXdmItem is a node value
Returns:
bool: Check for node value
Methods inherited from PyXdmValue:
- add_xdm_item(...)
- add_xdm_tem(self, PyXdmItem value)
Add PyXdmItem to the Xdm sequence
Args:
value (PyXdmItem): The PyXdmItem object
- item_at(...)
- item_at(self, index)
Get the n'th item in the value, counting from zero.
Args:
index (int): the index of the item required. Counting from zero
Returns:
PyXdmItem: Get the item indicated at the index. This could be PyXdmNode or PyXdmAtomicValue object. If the item does not exist return None.
Data descriptors inherited from PyXdmValue:
- size
- size(self)
Property - Get the number of items in the sequence
Returns:
int: The count of items in the sequence
|
class PyXdmNode(PyXdmItem) |
|
This class represents a node in the XDM data model. A Node is an <code>XdmItem</code>, and is therefore an
<code>XdmValue</code> in its own right, and may also participate as one item within a sequence value.
<p>The XdmNode interface exposes basic properties of the node, such as its name, its string value, and |
|
- Method resolution order:
- PyXdmNode
- PyXdmItem
- PyXdmValue
- builtins.object
Methods defined here:
- __reduce__ = __reduce_cython__(...)
- __repr__(...)
- ___repr__
- __setstate__ = __setstate_cython__(...)
- __str__(...)
- __str__(self)
The string value of the node as defined in the XPath data model
Returns:
str: String value of this node
- get_attribute_value(...)
- getAttribute_value(self, name)
The name of the required attribute
Args:
name(str): the eqname of the required attribute
- get_parent(...)
- get_parent(self)
Get the current node's parent
Returns:
PyXdmNode: The parent node as PyXdmNode object
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- attribute_count
- attribute_count(self)
Property to get the count of attribute nodes on this XdmNode object. If this current node is not an element node then return 0
Returns:
int: Count of attribute nodes
- attributes
- attribute_nodes(self)
Property to get the attribute nodes as a list of PyXdmNode objects
Returns:
list[PyXdmNode]: List of PyXdmNode objects
- base_uri
- base_uri(self)
Base uri Property. Get the Base URI for the node, that is, the URI used for resolving a relative URI contained in the node.
This will be the same as the System ID unless xml:base has been used. Where the node does not have a base URI of its own,
the base URI of its parent node is returned.
Returns:
str: String value of the base uri for this node. This may be NULL if the base URI is unknown, including the case
where the node has no parent.
- children
- children(self)
Property to get children of this current node. List of child nodes
Returns:
list[PyXdmNode]: List of PyXdmNode objects
- head
- head(self)
Property to get the first item in the sequence. This would be the PyXdmNode itself as there is only one item in the sequence
Returns:
PyXdmItem: The PyXdmItem or None if the sequence is empty
- name
- name(self)
Get the name of the node, as a string in the form of a EQName
Returns:
str: the name of the node. In the case of unnamed nodes (for example, text and comment nodes) return None
- node_kind
- node_kind(self)
Node Kind property. This will be a value such as {@link net.sf.saxon.type.Type#ELEMENT} or {@link net.sf.saxon.type.Type#ATTRIBUTE}.
There are seven kinds of node: documents, elements, attributes, text, comments, processing-instructions, and namespaces.
Returns:
int: an integer identifying the kind of node. These integer values are the same as those used in the DOM
- node_kind_str
- node_kind(self)
Node Kind property string. This will be a value such as {@link net.sf.saxon.type.Type#ELEMENT} or {@link net.sf.saxon.type.Type#ATTRIBUTE}.
There are seven kinds of node: documents, elements, attributes, text, comments, processing-instructions, and namespaces.
Returns:
int: an integer identifying the kind of node. These integer values are the same as those used in the DOM
- string_value
- string_value(self)
Property to get the string value of the node as defined in the XPath data model.
Returns:
str: The string value of this node
- typed_value
- typed_value(self)
Property - get the typed value of this node, as defined in XDM
Returns:
PyXdmValue:the typed value. If the typed value is a single atomic value, this will be returne as an instance of {@link XdmAtomicValue}
Methods inherited from PyXdmItem:
- get_atomic_value(...)
- get_atomic_value(self)
Get the subclass PyXdmAtomicValue for this PyXdmItem object current object if it is an atomic value
Returns:
PyXdmAtomicValue: Subclass this object to PyXdmAtomicValue or error
- get_map_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
- get_node_value(...)
- get_node_value(self)
Get the subclass PyXdmNode for this PyXdmItem object current object if it is a node value
Returns:
PyXdmNode: Subclass this object to PyXdmNode or error
Data descriptors inherited from PyXdmItem:
- is_array
- is_array(self)
Property to check if the current PyXdmItem is an XdmArray value
Returns:
bool: Check for array value
- is_atomic
- is_atomic(self)
Property to check if the current PyXdmItem is an atomic value
Returns:
bool: Check of is atomic value
- is_function
- is_atomic(self)
Property to check if the current PyXdmItem is a function value
Returns:
bool: Check of is atomic value
- is_map
- is_map(self)
Property to check if the current PyXdmItem is a map value
Returns:
bool: Check for map value
- is_node
- is_atomic(self)
Property to check if the current PyXdmItem is a node value
Returns:
bool: Check for node value
Methods inherited from PyXdmValue:
- __iter__(...)
- Returns the Iterator object of PyXdmValue
- add_xdm_item(...)
- add_xdm_tem(self, PyXdmItem value)
Add PyXdmItem to the Xdm sequence
Args:
value (PyXdmItem): The PyXdmItem object
- item_at(...)
- item_at(self, index)
Get the n'th item in the value, counting from zero.
Args:
index (int): the index of the item required. Counting from zero
Returns:
PyXdmItem: Get the item indicated at the index. This could be PyXdmNode or PyXdmAtomicValue object. If the item does not exist return None.
Data descriptors inherited from PyXdmValue:
- size
- size(self)
Property - Get the number of items in the sequence
Returns:
int: The count of items in the sequence
|
class PyXdmValue(builtins.object) |
|
Value in the XDM data model. A value is a sequence of zero or more items, each item being either an atomic value or a node. |
|
Methods defined here:
- __iter__(...)
- Returns the Iterator object of PyXdmValue
- __reduce__ = __reduce_cython__(...)
- __repr__(...)
- __repr__(self)
The string representation of PyXdmItem
- __setstate__ = __setstate_cython__(...)
- __str__(...)
- __str__(self)
The string representation of PyXdmItem
- add_xdm_item(...)
- add_xdm_tem(self, PyXdmItem value)
Add PyXdmItem to the Xdm sequence
Args:
value (PyXdmItem): The PyXdmItem object
- item_at(...)
- item_at(self, index)
Get the n'th item in the value, counting from zero.
Args:
index (int): the index of the item required. Counting from zero
Returns:
PyXdmItem: Get the item indicated at the index. This could be PyXdmNode or PyXdmAtomicValue object. If the item does not exist return None.
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- head
- head(self)
Property to get the first item in the sequence
Returns:
PyXdmItem: The PyXdmItem or None if the sequence is empty
- size
- size(self)
Property - Get the number of items in the sequence
Returns:
int: The count of items in the sequence
|
class PyXslt30Processor(builtins.object) |
|
An PyXslt30Processor represents factory to compile, load and execute a stylesheet.
It is possible to cache the context and the stylesheet in the PyXslt30Processor |
|
Methods defined here:
- __reduce__ = __reduce_cython__(...)
- __setstate__ = __setstate_cython__(...)
- clear_parameters(...)
- clear_parameter(self)
Clear all parameters set on the processor for execution of the stylesheet
- compile_stylesheet(...)
- compile_stylesheet(self, **kwds)
Compile a stylesheet received as text, uri or as a node object. The term "compile" here indicates
that the stylesheet is converted into an executable
form. The compilation uses a snapshot of the properties of the <code>Xslt30Processor</code> at the
time this method is invoked. It is also possible to save the compiled
stylesheet (SEF file) given the option 'save' and 'output_file'.
Get the stylesheet associated via the xml-stylesheet processing instruction (see
http://www.w3.org/TR/xml-stylesheet/) with the document
document specified in the source parameter, 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 module.
Args:
**kwds: Possible keyword arguments stylesheet_text (str), stylesheet_file (str),
associated_file (str) or stylesheet_node (PyXdmNode). Also possible to add the options
save (boolean) and output_file, which creates an exported stylesheet to file (SEF).
Returns:
PyXsltExecutable - which represents the compiled stylesheet. The XsltExecutable
is immutable and thread-safe; it may be used to run multiple transformations, in series or concurrently.
Example:
1. executable = xsltproc.compile_stylesheet(stylesheet_text="<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='2.0'>
<xsl:param name='values' select='(2,3,4)' /><xsl:output method='xml' indent='yes' />
<xsl:template match='*'><output><xsl:value-of select='//person[1]'/>
<xsl:for-each select='$values' >
<out><xsl:value-of select='. * 3'/></out>
</xsl:for-each></output></xsl:template></xsl:stylesheet>")
2. executable = xsltproc.compile_stylesheet(stylesheet_file="test1.xsl", save=True, output_file="test1.sef")
3. executable = xsltproc.compile(associated_file="foo.xml")
- exception_clear(...)
- exception_clear(self)
Clear any exception thrown
- get_parameter(...)
- get_parameter(self, name)
Get a parameter value by a given name
Args:
name (str): The name of the stylesheet parameter
Returns:
PyXdmValue: The Xdm value of the parameter
- remove_parameter(...)
- remove_parameter(self, name)
Remove the parameter given by name from the PyXslt30Processor. The parameter will not have any affect on the stylesheet if it has not yet been executed
Args:
name (str): The name of the stylesheet parameter
Returns:
bool: True if the removal of the parameter has been successful, False otherwise.
- set_cwd(...)
- set_cwd(self, cwd)
Set the current working directory.
Args:
cwd (str): current working directory
- set_jit_compilation(...)
- set_jit_compilation(self, jit)
Say whether just-in-time compilation of template rules should be used.
Args:
jit (bool): True if just-in-time compilation is to be enabled. With this option enabled,
static analysis of a template rule is deferred until the first time that the
template is matched. This can improve performance when many template
rules are rarely used during the course of a particular transformation; however,
it means that static errors in the stylesheet will not necessarily cause the
compile(Source) method to throw an exception (errors in code that is
actually executed will still be notified but this may happen after the compile(Source)
method returns). This option is enabled by default in Saxon-EE, and is not available
in Saxon-HE or Saxon-PE.
Recommendation: disable this option unless you are confident that the
stylesheet you are compiling is error-free.
- set_parameter(...)
- set_parameter(self, PyXdmValue value)
Set the value of a stylesheet parameter
Args:
name (str): the name of the stylesheet parameter, as a string. For namespaced parameter use the JAXP solution i.e. "{uri}name
value (PyXdmValue): the value of the stylesheet parameter, or NULL to clear a previously set value
- transform_to_file(...)
- transform_to_file(self, **kwds)
Execute transformation to a file. It is possible to specify the as an argument or using the set_output_file method.
Args:
**kwds: Possible optional arguments: source_file (str), stylesheet_file (str), output_file (str)
and base_output_uri (str) which is used for for resolving relative URIs in the href attribute of the
xsl:result-document instruction.
Example:
1) xsltproc.transform_to_file(source_file="cat.xml", stylesheet_file="test1.xsl", output_file="result.xml")
2) xsltproc.set_source("cat.xml")
xsltproc.setoutput_file("result.xml")
xsltproc.transform_to_file(stylesheet_file="test1.xsl")
- transform_to_string(...)
- transform_to_string(self, **kwds)
Execute transformation to string.
Args:
**kwds: Possible arguments: source_file (str) or xdm_node (PyXdmNode). Other allowed argument: stylesheet_file (str)
and base_output_uri (str) which is used for for resolving relative URIs in the href
attribute of the xsl:result-document instruction.
Example:
1) result = xsltproc.transform_to_string(source_file="cat.xml", stylesheet_file="test1.xsl")
2) xsltproc.set_source("cat.xml")
result = xsltproc.transform_to_string(stylesheet_file="test1.xsl")
3) node = saxon_proc.parse_xml(xml_text="<in/>")
result = xsltproc.transform_to_string(stylesheet_file="test1.xsl", xdm_node= node)
- transform_to_value(...)
- transform_to_value(self, **kwds)
Execute transformation to an PyXdmNode object
Args:
**kwds: Possible optional arguments: source_file (str), stylesheet_file (str)
and base_output_uri (str) which is used for for resolving relative URIs in the href attribute
of the xsl:result-document instruction.
Returns:
PyXdmNode: Result of the transformation as an PyXdmNode object
Example:
1) node = xsltproc.transform_to_value(source_file="cat.xml", stylesheet_file="test1.xsl")
2) xsltproc.set_source("cat.xml")
node = xsltproc.transform_to_value(stylesheet_file="test1.xsl")
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- error_code
- error_code(self)
A transformation may have a number of errors reported against it. This property returns the error code if there are any errors
Returns:
str: The error code associated with the exception. Return None if the exception does not exist.
- error_message
- error_message(self)
A transformation may have a number of errors reported against it. This property returns an error message if there are any errors
Returns:
str: The message of the exception. Return None if the exception does not exist.
- exception_occurred
- exception_occurred(self)
Property to check for pending exceptions without creating a local reference to the exception object
Returns:
boolean: True when there is an exception thrown; otherwise return False
|
class PyXsltExecutable(builtins.object) |
|
An PyXsltExecutable represents the compiled form of a stylesheet.
An XsltExecutable is created by using one of the compile methods on the
PyXsltProcessor |
|
Methods defined here:
- __reduce__ = __reduce_cython__(...)
- __setstate__ = __setstate_cython__(...)
- apply_templates_returning_file(...)
- apply_templates_returning_file(self, **kwds)
Invoke the stylesheet by applying templates to a supplied input sequence, Saving the
results to file.
Args:
**kwds: Possible optional arguments: source_file (str) or xdm_value (PyXdmValue).
Other allowed argument: The required argument output_file (str) and
base_output_uri (str) which is used for resolving relative URIs in the href attribute of
the xsl:result-document instruction.
Example:
1) executable = trans.compile_stylesheet(stylesheet_file="test1.xsl")
executable.set_initial_match_selection(file_name="cat.xml")
content = executable.apply_templates_returning_file(output_file="result.xml")
print(content)
- apply_templates_returning_string(...)
- apply_templates_returning_string(self, **kwds)
Invoke the stylesheet by applying templates to a supplied input sequence, Saving the results as a str.
Args:
**kwds: Possible optional arguments: source_file (str) or xdm_value (PyXdmValue). Other allowed argument:
base_output_uri (str) which is used for resolving relative URIs in the href attribute of
the xsl:result-document instruction
Returns:
str: Result of the transformation as str
Example:
xslt30_proc = saxon_proc.new_xsl30_processor()
executable = xslt30_proc.compile_stylesheet(stylesheet_file="test1.xsl")
1) executable.set_initial_match_selection(file_name="cat.xml")
content = executable.apply_templates_returning_string()
print(content)
2) node = saxon_proc.parse_xml(xml_text="<in/>")
content = executable.apply_templates_returning_string(xdm_value=node)
print(content)
- apply_templates_returning_value(...)
- apply_templates_returning_value(self, **kwds)
Invoke the stylesheet by applying templates to a supplied input sequence, Saving the results as an XdmValue.
Args:
**kwds: Possible optional arguments: source_file (str) or xdm_value (PyXdmValue). Other allowed argument:
base_output_uri (str) which is used for resolving relative URIs in the href attribute of
the xsl:result-document instruction.
Returns:
PyXdmValue: Result of the transformation as an PyXdmValue object
Example:
xslt30_proc = saxon_proc.new_xsl30_processor()
executable = xslt30_proc.compile_stylesheet(stylesheet_file="test1.xsl")
1) executable.set_initial_match_selection(file_name="cat.xml")
node = executable.apply_templates_returning_value()
2) node = executable.apply_templates_returning_value(source_file="cat.xml")
- call_function_returning_file(...)
- call_function_returning_file(self, str function_name, list args, **kwds)
Invoke a transformation by calling a named template and return result in the supplied file.
Args:
function_name(str): The name of the template to invoke. If None is supplied
then call the initial-template
list args: Pointer array of XdmValue object - he values of the arguments to be supplied to the function.
**kwds: Possible optional arguments: source_file (str) or xdm_value (PyXdmValue). Other allowed argument: stylesheet_file (str)
Example:
executable = xslt30_proc.compile_stylesheet(stylesheet_file="test2.xsl")
1) executable.set_output_file("result.xml")
executable.call_function_returning_file("{http://localhost/example}func")
2) executable.set_initial_match_selection(file_name="cat.xml")
executable.call_function_returning_file("{http://localhost/test}add", output_file="result.xml")
3) executable.set_initial_match_selection(file_name="cat.xml")
executable.call_function_returning_file("{http://exmaple.com}func1", output_file="result.xml")
- call_function_returning_string(...)
- call_function_returning_string(self, str function_name, list args, **kwds)
Invoke a transformation by calling a named template and return result as a serialized string.
Args:
function_name(str): The name of the template to invoke. If None is supplied then call the initial-template
list args: Pointer array of XdmValue object - he values of the arguments to be supplied to the function.
**kwds: Possible optional arguments: source_file (str) or xdm_value (PyXdmValue). Other allowed argument: stylesheet_file (str)
Returns:
str: Result of the transformation as a str value
Example:
executable = xslt30_proc.compile_stylesheet(stylesheet_file="test1.xsl")
1) result = executable.call_function_returning_string("{http://localhost/example}func")
2) executable.set_initial_match_selection(file_name="cat.xml")
result = executable.call_function_returning_string("{http://localhost/test}add")
3) executable.set_initial_match_selection(file_name="cat.xml")
result = executable.call_function_returning_string("{http://exmaple.com}func1")
- call_function_returning_value(...)
- call_function_returning_value(self, str function_name, list args, **kwds)
Invoke a transformation by calling a named template and return result as an PyXdmValue.
Args:
function_name(str): The name of the template to invoke. If None is supplied then call the initial-template
list args: Pointer array of XdmValue object - he values of the arguments to be supplied to the function.
**kwds: Possible optional arguments: source_file (str) or xdm_value (PyXdmValue).
Returns:
PyXdmValue: Result of the transformation as an PyXdmValue object
Example:
executable = xslt30_proc.compile_stylesheet(stylesheet_file="test1.xsl")
1) node = executable.call_function_returning_value("{http://localhost/example}func")
2) xsltproc.set_initial_match_selection(file_name="cat.xml")
value = executable.call_function_returning_value("{http://localhost/test}add")
3) value = executable.call_function_returning_value(source_file="cat.xml", "{http://exmaple.com}func1")
- call_template_returning_file(...)
- call_template_returning_file(self, str template_name, **kwds)
Invoke a transformation by calling a named template and save result in a specified file.
Args:
template_name(str): The name of the template to invoke. If None is supplied then call the initial-template
**kwds: Possible optional arguments: source_file (str) or xdm_node (PyXdmNode). Other allowed argument: stylesheet_file (str)
base_output_uri (str) which is used for for resolving relative URIs in the href attribute of the xsl:result-document instruction
Example:
executable = xslt30_proc.compile_stylesheet(stylesheet_file="test1.xsl")
1) executable.call_template_returning_file("main", output_file="result.xml")
2) executable.set_initial_match_selection(file_name="cat.xml")
executable.call_template_returning_file("main", output_file="result.xml")
3) executable.set_initial_match_selection(file_name="cat.xml")
executable.call_template_returning_file(output_file="result.xml")
print(result)
- call_template_returning_string(...)
- call_template_returning_string(self, str template_name, **kwds)
Invoke a transformation by calling a named template and return result as a string.
If no source file or xdm value has been supplied, then the clark name 'xsl:initial-template' is used.
Args:
template_name(str): The name of the template to invoke. If None is supplied then call the initial-template
**kwds: Possible optional arguments: source_file (str) or xdm_Value (PyXdmValue). Other allowed argument:
base_output_uri (str) which is used for for resolving relative URIs in the href attribute of the xsl:result-document instruction
Returns:
PyXdmValue: Result of the transformation as an PyXdmValue object
Example:
1) executable = trans.compile_stylesheet(stylesheet_file="test1.xsl")
result = executable.call_template_returning_string("main")
2) executable = trans.compile_stylesheet(stylesheet_file="test1.xsl")
executable.set_initial_match_selection(file_name="cat.xml")
result = executable.call_template_returning_string("main")
3) executable = trans.compile_stylesheet(stylesheet_file="test2.xsl")
executable.set_initial_match_selection(file_name="cat.xml")
result = executable.call_template_returning_string()
print(result)
- call_template_returning_value(...)
- call_template_returning_value(self, str template_name, **kwds)
Invoke a transformation by calling a named template and return result as an PyXdmValue.
Args:
template_name(str): The name of the template to invoke. If None is supplied then call the initial-template
**kwds: Possible optional arguments: source_file (str) or xdm_value (PyXdmValue). Other allowed argument:
base_output_uri (str) which is used for for resolving relative URIs in the href attribute of the xsl:result-document instruction
Returns:
PyXdmValue: Result of the transformation as an PyXdmValue object
Example:
xslt30_proc = saxon_proc.new_xsl30_processor()
executable = xslt30_proc.compile_stylesheet(stylesheet_file="test1.xsl")
1) node = executable.call_template_returning_value("main")
2) executable.set_initial_match_selection(file_name="cat.xml")
node = executable.call_template_returning_value("main")
- clear_parameters(...)
- clear_parameter(self)
Clear all parameters set on the processor for execution of the stylesheet
- clear_properties(...)
- clear_properties(self)
Clear all properties set on the processor
- clone(...)
- clone(self)
Create a clone object of this PyXsltExecutable object
Returns:
PYXsltExecutable: copy of this object
- exception_clear(...)
- exception_clear(self)
Clear any exception thrown
- export_stylesheet(...)
- export_stylesheet(self, file_name)
Produce a representation of the compiled stylesheet, in XML form, suitable for
distribution and reloading.
- get_parameter(...)
- get_parameter(self, name)
Get a parameter value by a given name
Args:
name (str): The name of the stylesheet parameter
Returns:
PyXdmValue: The Xdm value of the parameter
- get_result_documents(...)
- get_result_documents(self)
Return the result-documents resulting from the execution of the stylesheet. Null is
returned if the user has not enabled this feature via the method set_capture_result_documents
Returns:
dict [str, PyXdmValue]: Dict of the key, value pair. Indexed by the absolute URI of each result
document, and the corresponding value is an PyXdmValue object containing the result document (as
an in-memory tree, without serialization).
- remove_parameter(...)
- remove_parameter(self, name)
Remove the parameter given by name from the PyXslt30Processor. The parameter will not have any affect on the stylesheet if it has not yet been executed
Args:
name (str): The name of the stylesheet parameter
Returns:
bool: True if the removal of the parameter has been successful, False otherwise.
- set_base_output_uri(...)
- set_base_output_uri(self, base_uri)
Set the base output URI. The default is the base URI of the principal output
of the transformation. If a base output URI is supplied using this function then it takes precedence
over any base URI defined in the principal output, and
it may cause the base URI of the principal output to be modified in situ.
The base output URI is used for resolving relative URIs in the 'href' attribute
of the xsl:result-document instruction; it is accessible to XSLT stylesheet
code using the XPath current-output-uri() function.
Args:
base_uri (str): the base output URI
- set_capture_result_documents(...)
- set_capture_result_documents(self, value, raw_result)
Enable the capture of the result-document output into a dict. This overrides the default mechanism.
If this option is enabled, then any document created using xsl:result-document is saved (as a PyXdmNode)
in a dict object where it is accessible using the URI as a key. After the execution of the transformation
a call on the get_result_documents method is required to get access to the result-documents in the map.
It is also possible to capture the result-document as a raw result directly as an PyXdmValue, without
constructing an XML tree, and without serialization. It corresponds to the serialization.
Args:
value (bool): true causes secondary result documents from the transformation to be saved in a map;
false disables this option.
raw_result (bool): true enables the handling of raw destination for resultsDocuments. If not
supplied this can also be set on the setResultAsRawValue method. The setResultAsRawValue method
has higher priority to this flag
- set_cwd(...)
- set_cwd(self, cwd)
Set the current working directory.
Args:
cwd (str): current working directory
- set_global_context_item(...)
- Set the global context item for the transformation.
Args:
**kwds: Keyword argument can only be one of the following: file_name|xdm_item
Raises:
Exception: Exception is raised if keyword argument is not one of file_name or an Xdm item.
- set_initial_match_selection(...)
- set_initial_match_selection(self, **kwds)
The initial filename to which templates are to be applied (equivalent to the select attribute of xsl:apply-templates).
Args:
**kwds: Keyword argument can only be one of the following: file_name|xdm_value
Raises:
Exception: Exception is raised if keyword argument is not one of file_name or XdmValue.
- set_initial_mode(...)
- set_initial_mode(self, base_uri)
Set the initial mode for the transformation
Args:
name (str): he EQName of the initial mode. Two special values are recognized, in the
reserved XSLT namespace:
xsl:unnamed to indicate the mode with no name, and xsl:default to indicate the
mode defined in the stylesheet header as the default mode.
The value null also indicates the default mode (which defaults to the unnamed
mode, but can be set differently in an XSLT 3.0 stylesheet).
- set_initial_template_parameters(...)
- set_initial_template_parameters(self, bool tunnel, **kwds)
Set parameters to be passed to the initial template. These are used
whether the transformation is invoked by applying templates to an initial source item,
or by invoking a named template. The parameters in question are the xsl:param elements
appearing as children of the xsl:template element.
TODO: To fix issue where we pass XdmValue object created directly in the function argument. This causes seg error
e.g. set_initial_template_parameter(False, {a:saxonproc.make_integer_value(12)})
Do the following instead:
paramArr = {a:saxonproc.make_integer_value(12)}
set_initial_template_parameter(False, paramArr)
Args:
tunnel (bool): True if these values are to be used for setting tunnel parameters;
**kwds: the parameters to be used for the initial template supplied as an key-value pair.
False if they are to be used for non-tunnel parameters. The default is false.
Example:
1)paramArr = {'a':saxonproc.make_integer_value(12), 'b':saxonproc.make_integer_value(5)}
xsltproc.set_initial_template_parameters(False, paramArr)
- set_output_file(...)
- set_output_file(self, output_file)
Set the output file where the output of the transformation will be sent
Args:
output_file (str): The output file supplied as a str
- set_parameter(...)
- set_parameter(self, PyXdmValue value)
Set the value of a stylesheet parameter
Args:
name (str): the name of the stylesheet parameter, as a string. For namespaced parameter use the JAXP solution i.e. "{uri}name
value (PyXdmValue): the value of the stylesheet parameter, or NULL to clear a previously set value
- set_property(...)
- set_property(self, name, value)
Set a property specific to the processor in use.
Args:
name (str): The name of the property
value (str): The value of the property
Example:
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,
'item'| 'node' : source supplied as an XdmNode object,
'extc':Set the native library to use with Saxon for extension functions written in C/C++/PHP
- set_result_as_raw_value(...)
- set_result_as_raw_value(self, is_raw)
Set true if the return type of callTemplate, applyTemplates and transform methods is to return XdmValue, otherwise return XdmNode object with root Document node
Args:
is_raw (bool): True if returning raw result, i.e. XdmValue, otherwise return XdmNode
- set_save_xsl_Message(...)
- setup_xsl_message(self, **kwds)
gives users the option to switch on or off the <code>xsl:message</code> feature. It is also possible
to send the <code>xsl:message</code> outputs to file given by file name.
- transform_to_file(...)
- transform_to_file(self, **kwds)
Execute transformation to a file. It is possible to specify the as an argument or using the set_output_file method.
Args:
**kwds: Possible optional arguments: source_file (str) or xdm_node (PyXdmNode). Other allowed argument: output_file (str)
and base_output_uri (str) which is used for for resolving relative URIs in the href attribute of the
xsl:result-document instruction.
Example:
1) executable = xslt30_proc.compile_stylesheet(stylesheet_file="test1.xsl")
executable.transform_to_file(source_file="cat.xml", output_file="result.xml")
2) executable.set_initial_match_selection("cat.xml")
executable.set_output_file("result.xml")
executable.transform_to_file(stylesheet_file="test1.xsl")
3) node = saxon_proc.parse_xml(xml_text="<in/>")
executable = xslt30_proc.compile_stylesheet(stylesheet_file="test1.xsl")
executable.transform_to_file(output_file="result.xml", xdm_node= node)
- transform_to_string(...)
- transform_to_string(self, **kwds)
Execute transformation to string.
Args:
**kwds: Possible arguments: source_file (str) or xdm_node (PyXdmNode). Other allowed argument: base_output_uri (str)
which is used for for resolving relative URIs in the href attribute of the xsl:result-document instruction.
Example:
1) result = executable.transform_to_string(source_file="cat.xml")
2) executable.set_initial_match_selection(file_name="cat.xml")
result = executable.transform_to_string(stylesheet_file="test1.xsl", xdm_node= node)
3) node = saxon_proc.parse_xml(xml_text="<in/>")
result = executable.transform_to_string(xdm_node= node)
- transform_to_value(...)
- transform_to_value(self, **kwds)
Execute transformation to an Xdm Node
Args:
**kwds: Possible optional arguments: source_file (str), xdm_node (PyXdmNode) and base_output_uri (str) which
is used for resolving relative URIs in the href attribute
of the xsl:result-document instruction.
Returns:
PyXdmNode: Result of the transformation as an PyXdmNode object
Example:
xslt30_proc = saxon_proc.new_xsl30_processor()
executable = xslt30_proc.compile_stylesheet(stylesheet_file="test1.xsl")
1) node = executable.transform_to_value(source_file="cat.xml")
2) executable.set_initial_match_selection("cat.xml")
node = executable.transform_to_value()
3) node = saxon_proc.parse_xml(xml_text="<in/>")
node = executable.transform_to_value(xdm_node= node)
Static methods defined here:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors defined here:
- error_message
- error_message(self)
A transformation may have a number of errors reported against it. Get the error message if there are any errors
Returns:
str: The message of the exception. Return None if the exception does not exist.
- exception_occurred
- exception_occurred(self)
Property to check for pending exceptions without creating a local reference to the exception object
Returns:
boolean: True when there is a pending exception; otherwise return False
| |