- style_filename = os.path.join(os.path.dirname(__file__), 'book2html.xslt')
- style = etree.parse(style_filename)
-
- if is_file:
- document = WLDocument.from_file(input, True)
- else:
- document = WLDocument.from_string(input, True)
-
- result = document.transform(style)
- del document # no longer needed large object :)
-
- if result.find('//p') is not None:
- add_anchors(result.getroot())
- add_table_of_contents(result.getroot())
-
- if output_filename is not None:
- result.write(output_filename, xml_declaration=False, pretty_print=True, encoding='utf-8')
+ try:
+ style_filename = get_stylesheet(stylesheet)
+ style = etree.parse(style_filename)
+
+ if is_file:
+ document = WLDocument.from_file(input, True, \
+ parse_dublincore=parse_dublincore)