Greetings. Wanted to convert xml , ( providing xslt and some images ) to html report using Qt ( 6.5 ) earlier versions had QxmlQuery to achieve that and it was achieved within 3-4 lines of code. With latest versions , is it possible to do so ? Any equivalent clss or converter classes I can use ?
thanks & warm regards, ~ Rudresh
QFile myFile("D:/Report.xml");
if (!myFile.open(QIODevice::ReadOnly | QIODevice::Text))
return -1 ;
QString contents = myFile.readAll();
QTextDocument qd (contents);
myFile.close();
QFile cssFile( "Report.xslt");
cssFile.open(QFile::ReadOnly);
qd.setDefaultStyleSheet(cssFile.readAll());
//qd.setHtml(cssFile.readAll());
//QString html = qd.tr(cssFile.readAll());
qd.setHtml(contents);
QString html = qd.toHtml();
qDebug() << html ;
QFile outfile ("report.html");
if ( !outfile.open(QIODevice::WriteOnly) )
return -1 ;
QTextStream out(&outfile);
out << html ;
outfile.close();