Writing to KHTMLPart and stylesheets

Maksim Orlovich mo85 at cornell.edu
Wed Aug 5 01:31:17 BST 2009


On Tuesday 04 August 2009 20:01:24 Michael Leupold wrote:
> 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).

Very cool.

> 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?

You can set the mimetype you want via KParts' arguments:
KParts::OpenUrlArguments args = part->arguments();
args.setMimeType("foo/bar");
part->setArguments(args);


> 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?

Yeah. Look for a PROCESSING_INSTRUCTION_NODE child of the document, and go 
from there. (Hmm, maybe we should export traverseNextChild/traversePrevChild 
in public API)?

Thanks,
Maks




More information about the kfm-devel mailing list