Python Forum

Full Version: How to render xml with extended xslt
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,

I'm new to playing with XML files

I'm trying to render XML file with XSL stylesheet file via code below in python3:
from lxml.etree as ET

def render_xml():
    xml_content = ET.parse(open('xml_file.xml', 'r'))
    xml_stylesheet = ET.parse(open('xsl_stylesheet.xsl', 'r'))

    transform = ET.XSLT(xml_stylesheet)
    rendered_xml = transform(xml_content)

    return HttpResponse(rendered_xml)
But it's rendered partially as image below:
[Image: iAZHuh2UVKHjeNTOMlSODRgICAuepqPsSF7TGw3I...88-h491-no]

It should be like:
[Image: Yn4kEnK190WLeKoU9b6F6r0RWjJzsE7TEmK2a8gu...58-h630-no]

Can anyone help to show where the problem is?

Here are the files:
xml_file.xml
xsl_stylesheet.xsl