lxml.etree.XSLT

Package lxml :: Module etree :: Class XSLT |
[frames] | no frames]

# Class XSLT

    object --+
             |
            XSLT

XSLT(self, xslt_input, extensions=None, regexp=True, access_control=None)

Turn an XSL document into an XSLT object.

Calling this object on a tree or Element will execute the XSLT:

    >>> transform = etree.XSLT(xsl_tree)
    >>> result = transform(xml_tree)

Keyword arguments of the constructor:

- regexp: enable exslt regular expression support in XPath (default: True)
- access_control: access restrictions for network or file system (see XSLTAccessControl)

Keyword arguments of the XSLT call:

- profile_run: enable XSLT profiling (default: False)

Other keyword arguments of the call are passed to the stylesheet as parameters.

Instance Methods
__call__(self, _input, profile_run=False, **_kw) Execute the XSL transformation on a tree or Element. |
__copy__(...) |
__deepcopy__(...) |
__init__(self, xslt_input, extensions=None, regexp=True, access_control=None) x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
a new object with type S, a subtype of T |
__new__(T, S, ...) |
apply(self, _input, profile_run=False, **_kw) |
tostring(self, result_tree) Save result doc to string based on stylesheet output method. |
Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Properties
| error_log The log of errors and warnings of an XSLT execution.
Inherited from `object`: `__class__`

Method Details

### __call__(self, _input, profile_run=False, **_kw) (Call operator) |
Execute the XSL transformation on a tree or Element. Pass the `profile_run` option to get profile information about the XSLT. The result of the XSLT will have a property xslt_profile that holds an XML tree with profiling data.

### __init__(self, xslt_input, extensions=None, regexp=True, access_control=None) (Constructor) |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__

### __new__(T, S, ...) |
Returns: a new object with type S, a subtype of T Overrides: object.__new__

### apply(self, _input, profile_run=False, **_kw) |
Deprecated: call the object, not this method.

### tostring(self, result_tree) |
Save result doc to string based on stylesheet output method. Deprecated: use str(result_tree) instead.