Hi all,
Using a python-based build tool, I decided to use lxml directly instead of calling xsltproc in order to transform docbook sources.
The docbook sources contain olinks (links between documents).
Everything works fine when using xsltproc.
I tried the following :
def xsltproc(xml_filename, xslt_filename, **kw):
parser = etree.XMLParser()
xml_doc = etree.parse(xml_filename, parser)
print xml_doc.getroot().base
xml_doc.xinclude()
xslt_doc = etree.parse(xslt_filename)
ac = etree.XSLTAccessControl(read_network=True, write_file=True, read_file=True, create_dir=True)
transform = etree.XSLT(xslt_doc, access_control=ac)
result_tree = transform(xml_doc, **kw)
res = etree.tostring(result_tree, pretty_print=True, encoding="utf-8", xml_declaration=True)
print "Transform\n", transform.error_log
print "Parser\n", parser.error_log
if not res:
raise Exception("pouet")
return res
kw = {
"olink.base.uri" : "doc.html",
"collect.xref.targets" : "yes",
"targets.filename" : "doc.html.db",
"target.database.document" : "olinkdb-html.xml",
}
res = xsltproc("doc.xml", ".../xsl/xhtml/docbook.xsl", **kw)
with open("pouet", "w") as f:
f.write(res)
This code fails silently (Exception("pouet") is raised).
If I comment the line with remove collect.xref.targets, a document is correctly output.
But the olinks are screwed.
Somehow the xslt transformer is not able to read the olink information of other documents, by reading the pointers in olinkdb-html.xml.
It seems that the silent failure is a bug, and I may be missing some stuff in order to convert the documents properly.
More complete test cases available upon request.
Thank you all,
--
cJ