[XML-SIG] [ pyxml-Bugs-418324 ] [4XSLT] bug report and patch for complex
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 23 Apr 2001 11:56:44 -0700
Bugs item #418324, was updated on 2001-04-23 11:56
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=106473&aid=418324&group_id=6473
Category: 4Suite
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Mike Olson (mikeolson)
Assigned to: Nobody/Anonymous (nobody)
Summary: [4XSLT] bug report and patch for complex
Initial Comment:
Email from "Olivier CAYROL (Logilab)"
<Olivier.Cayrol@logilab.fr>
Hello,
I found a vicious bug in 4XSLT (hidden very deeply in
the code).
Attached to this message you will find a tar.gz file
containing a
directory tree that exhibits the bug. It is a little
application for
managing Easter rabbits and eggs distribution (!).
There is an XML file
that contains the data: easter_mng.xml, an XSL
Transformation file:
xsl/transf.xsl and XML files containing data for
localization:
lib/common.xml, lib/en.xml, lib/fr.xml.
The lib/common.xml file is imported in the XSLT
stylesheets with the
'document()' function and is used to insert
language-dependant tags in
the output. This common.xml file imports other XML
files (one per
language) with the classic external ENTITY mechanism of
XML.
When trying to transform the data file from the main
directory with
the following line command:
4xslt -Dlang=en easter_mng.xml xsl/transf.xsl
, I got this exception:
...
File
"/usr/lib/python1.5/site-packages/xml/xslt/XsltFunctions.py",
line 63, in Document
doc =
context.stylesheet._docReader.fromUri(uri,
baseUri=baseUri)
File
"/usr/lib/python1.5/site-packages/Ft/Lib/ReaderBase.py",
line
67, in fromUri
rt = self.fromStream(stream, baseUri, ownerDoc,
stripElements)
File
"/usr/lib/python1.5/site-packages/Ft/Lib/pDomlette.py",
line 5
78, in fromStream
raise FtException(Error.XML_PARSE_ERROR,
p.ErrorLineNumber, p.Err
orColumnNumber, expat.ErrorString(p.ErrorCode))
Ft.Lib.FtException: ('XML parse error at line 16,
column 2: error i
n processing external entity reference', (16, 2,
'error in processing
external entity reference'))
In fact, there is a problem when 4XSLT reads the XML
document
referenced in the 'document()' function: this XML file
contains ENTITYs
that import XML tree parts by giving local paths from
the current
document directory whereas in 4XSLT, the baseUri is
always the URI of
the initial XSLT. The XML reader is unable to find the
external entities
and the bug appears.
Replacing line 67 of Ft.Lib.ReaderBase.py in
DomletteReader.fromUri
function:
rt = self.fromStream(stream, baseUri, ownerDoc,
stripElements)
with :
newBaseUri = urllib.basejoin(baseUri, uri)
rt = self.fromStream(stream, newBaseUri, ownerDoc,
stripElements)
fixes the bug.
I initially found the bug while trying to process
Norman Walsh's XSLT
stylesheets for turning docbook files in XSL formatting
objects files (I
am unfortunately not working for the Easter Rabbit).
Regards,
O. CAYROL.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=106473&aid=418324&group_id=6473