I am currently starting with win32com package. I have XSL file where I am using COM object programmed in Python:
<xsl:value-of select="plugin:GetTest(.)"/>
XSL transformation is done using MSXML2 XSL processor and python COM object is injected using addObject method. Implementation of the GetTest method is as follows:
def GetTest(self, obj):
IID_IXMLDOMNode = IID("{2933BF80-7B36-11d2-B20E-00C04F983E60}")
try:
node = win32com.client.Dispatch(obj, None, IID_IXMLDOMNode)
#node = obj.QueryInterface(IID_IXMLDOMNode)
return node.get_text()
except Exception as e:
return format_exc()
The obj argument has type PyIDispatch. In order to work with my IXMLDOMNode node interface I have to obtain it somehow, right? However, the uncommented approach fails with
AttributeError: <unknown>.get_text
And the commented approach fails with
obj.QueryInterface(IID_IXMLDOMNode)<\u000d>pywintypes.com_error: (-2147467262, 'No such interface supported'
Can anybody has suggestion what am doing wrong? Thanks in advance.