def applyStylesheet(self, doc, params): """Apply the stylesheet to the document""" if doc == None: doc__o = None else: doc__o = doc._o ret = libxsltmod.xsltApplyStylesheet(self._o, doc__o, params) if ret == None: return None return libxml2.xmlDoc(_obj=ret)
def applyStylesheetUser(self, doc, params, transformCtxt): """Apply the stylesheet to the document""" if doc == None: doc__o = None else: doc__o = doc._o if transformCtxt == None: transformCtxt__o = None else: transformCtxt__o = transformCtxt._o ret = libxsltmod.xsltApplyStylesheetUser(self._o, doc__o, params, transformCtxt__o) if ret == None: return None return libxml2.xmlDoc(_obj=ret)
def doc(self): """Get the document being parsed. :return: the document. :returntype: `libxml2.xmlNode`""" ret=self.reader.doc() if ret: return libxml2.xmlDoc(ret) else: return None
def doc(self): """Get the document being parsed. :return: the document. :returntype: `libxml2.xmlNode`""" ret = self.reader.doc() if ret: return libxml2.xmlDoc(ret) else: return None
def QueryTypeId(self, tpid): """ Queries the DMI data structure for a specific DMI type. """ if self.restype == DMIXML_NODE: ret = libxml2.xmlNode(_obj=xmlapi( query_type='t', result_type=self.restype, typeid=tpid)) elif self.restype == DMIXML_DOC: ret = libxml2.xmlDoc(_obj=xmlapi( query_type='t', result_type=self.restype, typeid=tpid)) else: raise TypeError, "Invalid result type value" return ret
def profileInformation(self): """This function should be called after the transformation completed to extract template processing profiling informations if availble. The informations are returned as an XML document tree like <?xml version="1.0"?> <profile> <template rank="1" match="*" name="" mode="" calls="6" time="48" average="8"/> <template rank="2" match="item2|item3" name="" mode="" calls="10" time="30" average="3"/> <template rank="3" match="item1" name="" mode="" calls="5" time="17" average="3"/> </profile> The caller will need to free up the returned tree with xmlFreeDoc()""" ret = libxsltmod.xsltGetProfileInformation(self._o) if ret == None: return None return libxml2.xmlDoc(_obj=ret)
def QuerySection(self, sectname): """ Queries the DMI data structure for a given section name. A section can often contain several DMI type elements """ if self.restype == DMIXML_NODE: ret = libxml2.xmlNode(_obj=xmlapi( query_type='s', result_type=self.restype, section=sectname)) elif self.restype == DMIXML_DOC: ret = libxml2.xmlDoc(_obj=xmlapi( query_type='s', result_type=self.restype, section=sectname)) else: raise TypeError, "Invalid result type value" return ret
def QueryTypeId(self, tpid): """ Queries the DMI data structure for a specific DMI type. """ if self.restype == DMIXML_NODE: ret = libxml2.xmlNode( _obj = xmlapi(query_type='t', result_type=self.restype, typeid=tpid)) elif self.restype == DMIXML_DOC: ret = libxml2.xmlDoc( _obj = xmlapi(query_type='t', result_type=self.restype, typeid=tpid)) else: raise TypeError("Invalid result type value") return ret
def QuerySection(self, sectname): """ Queries the DMI data structure for a given section name. A section can often contain several DMI type elements """ if self.restype == DMIXML_NODE: ret = libxml2.xmlNode( _obj = xmlapi(query_type='s', result_type=self.restype, section=sectname) ) elif self.restype == DMIXML_DOC: ret = libxml2.xmlDoc( _obj = xmlapi(query_type='s', result_type=self.restype, section=sectname) ) else: raise TypeError("Invalid result type value") return ret
def doc(self): """Get the document of a stylesheet""" ret = libxsltmod.xsltStylesheetGetDoc(self._o) if ret == None: return None return libxml2.xmlDoc(_obj=ret)
def createRVT(self): """Create a result value tree""" ret = libxsltmod.xsltCreateRVT(self._o) if ret == None: return None return libxml2.xmlDoc(_obj=ret)
def outputDoc(self): """Get the output document of a transformation""" ret = libxsltmod.xsltTransformGetOutputDoc(self._o) if ret == None: return None return libxml2.xmlDoc(_obj=ret)
def _stream_end(self, _doc): """Process stream end.""" doc = libxml2.xmlDoc(_doc) self.stream_end(doc)
def _stream_start(self, _doc): """Process stream start.""" doc = libxml2.xmlDoc(_doc) self.stream_start(doc)
def createRVT(self): """Creates a Result Value Tree (the XSLT 1.0 term for this is "Result Tree Fragment")""" ret = libxsltmod.xsltCreateRVT(self._o) if ret == None: return None return libxml2.xmlDoc(_obj=ret)
def _stream_end(self,_doc): """Process stream end.""" doc=libxml2.xmlDoc(_doc) self.stream_end(doc)
def _stream_start(self,_doc): """Process stream start.""" doc=libxml2.xmlDoc(_doc) self.stream_start(doc)
def _stanza(self,_doc,_node): """Process complete stanza.""" doc=libxml2.xmlDoc(_doc) node=libxml2.xmlNode(_node) self.stanza(doc,node)
def _stanza(self, _doc, _node): """Process complete stanza.""" doc = libxml2.xmlDoc(_doc) node = libxml2.xmlNode(_node) self.stanza(doc, node)