4 #include <qmessagebox.h>
11 xsltprocessor="xsltproc";
13 dia=new ShowTextDialog;
16 XSLTProc::~XSLTProc ()
21 void XSLTProc::addStringParam (const QString & k, const QString &v)
23 stringParamKey.append (k);
24 stringParamVal.append (v);
27 void XSLTProc::setOutputFile (const QString &s)
32 void XSLTProc::setXSLFile(const QString &s)
37 void XSLTProc::setInputFile (const QString &s)
42 void XSLTProc::addOutput (const QString &s)
47 void XSLTProc::process()
50 Process *xsltProc=new Process ();
51 xsltProc->clearArguments();
52 xsltProc->addArgument (xsltprocessor);
54 QStringList::Iterator itk;
55 QStringList::Iterator itv=stringParamVal.begin();
57 for ( itk = stringParamKey.begin(); itk != stringParamKey.end(); ++itk )
59 xsltProc->addArgument ("--stringparam");
60 xsltProc->addArgument (*itk);
61 xsltProc->addArgument (*itv);
65 xsltProc->addArgument ("--output");
66 xsltProc->addArgument (outputFile);
67 xsltProc->addArgument (xslFile);
68 xsltProc->addArgument (inputFile);
69 dia.append ("vym is executing: \n" + xsltProc->arguments().join(" ") );
71 cout <<QString("vym is executing: \n" + xsltProc->arguments().join(" ")) <<endl;
72 if (!xsltProc->start() )
74 QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
75 QObject::tr("Could not start %1").arg(xsltprocessor) );
78 xsltProc->waitFinished();
79 if (!xsltProc->normalExit() )
80 QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
81 QObject::tr("%1 didn't exit normally").arg(xsltprocessor) +
82 xsltProc->getErrout() );
84 if (xsltProc->exitStatus()>0) showOutput=true;
88 dia.append (xsltProc->getErrout());
89 dia.append (xsltProc->getStdout());
91 if (showOutput) dia.exec();