Writing to KHTMLPart and stylesheets

Michael Leupold lemma at confuego.org
Wed Aug 5 01:01:24 BST 2009


Hi,

I'm currently trying to create a small plugin for applying XSL 
transformations to XML documents loaded in Konqueror (using libxml and 
libxslt as QtXmlPatterns' XSLT isn't fully compliant with eg. docbook).

Most of what I'm doing is already working but I'm having trouble writing the 
output back to the KHTMLPart if its document type doesn't match the 
currently loaded document.

I've been using this small example:
-----------------------
part->begin();
part->write("<html><head><meta http-equiv=\"Content-Type\""
   "content=\"text/html; charset=UTF-8\"></head><body><p align=\"center\""
   "style=\"font-family:Tahoma; font-size:64px; color:red\">hello"
   "world!</p></body></html>");
part->end();
------------------------

If there's currently no document loaded or if the currently loaded document 
is a html document (no matter if it has an <?xml?> header or not), the 
output is displayed properly.
However if the current document is an xml document of unknown type it 
displays a parsing error (as the new content is not proper xml because meta 
misses the ending tag).

Is there any way I could work around this?

Apart from that I've also been failing to get the attributes of an embedded 
<?xml-stylesheet?> with type "text/xsl" using part->document()-
>styleSheets(). It seems this only gives me css stylesheets. Is this 
assumption correct and the behaviour intended?

Thanks and kind regards,
Michael






More information about the kfm-devel mailing list