Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-36158

QXmlQuery evaluateTo() gives wrong output

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.2.0
    • Fix Version/s: None
    • Component/s: XML: QtXmlPatterns
    • Labels:
      None
    • Environment:
      Windows 7

      Description

      xsl validator does not work correctly in Qt. It fails to generate the table contents of a table. Verified with Altova XMLSpy 2014 that xsl is valid and it gives the correct output.
      In Qt it seems that this line is causing the problem:
      <xsl:if test="string($issueTypeName) = string($typeName)">
      Problem can be repeated with following code, attached is the whole example

      #include <QApplication>
      #include <QXmlQuery>
      #include <qdebug.h>
      #include <QFile>
      #include <QXmlResultItems>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          bool ok;
          QString htmlString;
          QXmlResultItems result;
          QXmlQuery query(QXmlQuery::XSLT20);
          ok = query.setFocus(QUrl("qrc:/ChangeLog.xml"));
          query.setQuery(QUrl("qrc:/ChangeLog.xsl"));
          query.evaluateTo(&htmlString);
      
      
          QFile file("out.html");
          if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
              return 0;
      
          QTextStream out(&file);
          out << htmlString;
      
          qDebug()<<htmlString;
      
          return 0;
      }
      

        Attachments

        1. ChangeLog.xml
          3 kB
        2. ChangeLog.xsl
          1 kB
        3. output.png
          output.png
          25 kB
        4. QTBUG-36158.zip
          3 kB
        5. xmlquery.zip
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              qtcomsupport Qt Support
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes