easymode.xslt

Contains xslt transformation functionality to be used with django models

exception easymode.xslt.XsltError

The xslt transformation resulted in an error

easymode.xslt.transform(xml, xslt_path, params=None)

Transform xslt using any of the 2 supported xslt engines:

Parameters:
  • xml – The xml to be transformed.
  • xslt – The xslt to be used when transforming the xml.
  • params – A dictionary containing xslt parameters. Use prepare_string_param() on strings you want to pass in.
easymode.xslt.prepare_string_param(string)

Prepare a string for passing as a parameter to the xslt processor.

Parameters:string – The string you want to pass to the xslt.

easymode.xslt.response

Defines a render_to_response() function that resembles django.utils’s render_to_response() helper. Only this time the template is an xslt and the object passed as the second argument must have a __xml__ method. (See toxml())

easymode.xslt.response.render_to_response(template, object, params=None, mimetype='text/html')

object will be converted to xml using easymode.tree.xml(). The resulting xml will be transformed using template. The result will be a HttpResponse object, containing the transformed xml as the body.

Parameters:
Return type:

django.http.HttpResponse

easymode.xslt.response.render_to_string(template, object, params=None)

object will be converted to xml using easymode.tree.xml(). The resulting xml will be transformed using template. The result is a unicode string containing the transformed xml.

Parameters:
Return type:

unicode

easymode.xslt.response.render_xml_to_string(template, input, params=None)

Transforms input using template, which should be an xslt.

Parameters:
  • template – an xslt template name.
  • input – an string that contains xml
  • params – A dictionary containing xslt parameters. Use prepare_string_param() on strings you want to pass in.
Return type:

unicode

Table Of Contents

Previous topic

easymode.tree

Next topic

easymode.utils