Package lxml :: Module etree :: Class XSLT
[hide private]
[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:

Keyword arguments of the XSLT call:

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

Instance Methods [hide private]
 
__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 help(type(x)) 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__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
set_global_max_depth(max_depth)
The maximum traversal depth that the stylesheet engine will allow. This does not only count the template recursion depth but also takes the number of variables/parameters into account. The required setting for a run depends on both the stylesheet and the input data.
 
strparam(strval)
Mark an XSLT string parameter that requires quote escaping before passing it into the transformation. Use it like this:
Properties [hide private]
  error_log
The log of errors and warnings of an XSLT execution.

Inherited from object: __class__

Method Details [hide private]

__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 help(type(x)) 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.

set_global_max_depth(max_depth)
Static Method

 

The maximum traversal depth that the stylesheet engine will allow. This does not only count the template recursion depth but also takes the number of variables/parameters into account. The required setting for a run depends on both the stylesheet and the input data.

Example:

XSLT.set_global_max_depth(5000)

Note that this is currently a global, module-wide setting because libxslt does not support it at a per-stylesheet level.

strparam(strval)
Static Method

 

Mark an XSLT string parameter that requires quote escaping before passing it into the transformation. Use it like this:

result = transform(doc, some_strval = XSLT.strparam(
    '''it's "Monty Python's" ...'''))

Escaped string parameters can be reused without restriction.

tostring(self, result_tree)

 
Save result doc to string based on stylesheet output method.

Deprecated: use str(result_tree) instead.