Hi, I received the following files:
merge.py:
from lxml import etree xml_input = etree.XML(open('a.xml', 'r').read()) xslt_root = etree.XML(open('merge.xsl', 'r').read()) transform = etree.XSLT(xslt_root) print str(transform(xml_input))
merge.xsl:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <merge> <xsl:copy-of select="."/> <xsl:copy-of select="document('b.xml')"/> </merge> </xsl:template>
a.xml:
<?xml version="1.0" encoding="ISO-8859-1"?> <a> <test id="1"/> </a>
b.xml:
<?xml version="1.0" encoding="ISO-8859-1"?> <b> <test id="2"/> </b>
The 4 files are in the same directory when I call merge.py. I got an error:
lxml.etree.XSLTApplyError: Cannot resolve URI string:
Any idea? what am I mistaken on?
source share