Re: [xsl] MSXML DOCTYPE error

Subject: Re: [xsl] MSXML DOCTYPE error
From: Ronan Klyne <ronan.klyne@xxxxxxxxxxx>
Date: Tue, 24 Jun 2008 15:00:00 +0100
Luke Stedman wrote:
Hey guys,

I have been banging my head against this issue for the past hour or so.

I have taken on a legacy system built around Python scripts and the
MSXML parser, I am currently in the process of cleaning up the XSL's -
as part of this exercise I have moved a number of variable
declarations that are use as global constants and moved them to an
external dtd file, and have come across a strange issue.

When the dtd's are defined in the XSL file:

<!DOCTYPE xsl:stylesheet [
     <!ENTITY SYSTEM "./det_1.dtd">
     <!ENTITY SYSTEM "./det_2.dtd">
]>

The MSXML parser fails and gives the following error (The MSXML Parser
is being accessed via win32com):

File "C:\Python25\Lib\site-packages
\win32com\client\dynamic.py", line 538,
  in __setattr__ self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value)
    pywintypes.com_error: (-2147352567, 'Exception occurred.', (0,
u'msxml3.dll', u'The stylesheet does not contain a document element.
The stylesheet may be empty, or it may not be a well-formed XML
document.\r\n', None, 0, -2147467259), None)

When I remove the DOCTYPE section the parser loads the XSL's fine but
error's when it comes across an unreferenced entity.

Any pointers/advice would be extremely helpful.

As mentioned above I have inherited this system and am looking to move
it to something more reliable and, preferably, native to Python -
Amara is the current favourite.

I think that this will be to do with a lack of a definition for the 'xsl:' prefix used in the DOCTYPE declaration.


But I'm not sure.

I'm mainly chipping in to say that I've found libxml2 + libxslt to work very well with Python (although not natively). It's reliable, well tested, fast, and easy to use...

Ronan

--
Ronan Klyne
Business Collaborator Developer
Tel: +44 01189 028518
ronan.klyne@xxxxxxxxxxx
www.groupbc.com

Current Thread