Hello all,

I've the following simple code scratch:
Qt Code:
  1. QCoreApplication xApplication(argc, argv);
  2.  
  3. QXmlQuery xQuery(QXmlQuery::XSLT20);
  4. QBuffer xOriginalContent;
  5. QString xXMLContent = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><folder id=\"0\" name=\"root\" is_expanded=\"false\"></folder>";
  6. xOriginalContent.setData( xXMLContent.toAscii() );
  7. xOriginalContent.open(QBuffer::ReadWrite);
  8. xOriginalContent.reset();
  9.  
  10. xQuery.setFocus(&xOriginalContent);
  11. QString xRequestString;
  12. xRequestString += "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
  13. "<xsl:stylesheet version=\"2.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">"
  14. " <xsl:template match=\"/\">"
  15. " <xsl:apply-templates/>"
  16. " </xsl:template>"
  17. " <xsl:template match=\"folder\">"
  18. " <folder name=\"{@name}\" id=\"{@id}\" is_expanded=\"{@is_expanded}\">"
  19. " <xsl:copy-of select=\"child::node()\"/>"
  20. " <xsl:if test=\"@id=0\">"
  21. " <folder id=\"1\" name=\"name\"> </folder>"
  22. " </xsl:if>"
  23. " </folder>"
  24. " </xsl:template>"
  25. " <xsl:template match=\"*\">"
  26. " <xsl:copy-of select=\".\"/>"
  27. " </xsl:template>"
  28. "</xsl:stylesheet>";
  29.  
  30. xQuery.setQuery(xRequestString);
  31. assert(xQuery.isValid());
  32. QBuffer xOutputContent;
  33. xOutputContent.open(QBuffer::ReadWrite);
  34. xOutputContent.reset();
  35. std::string str1(xOriginalContent.data());
  36. xQuery.evaluateTo(&xOutputContent);
  37. xXMLContent = xOutputContent.data() ;
  38. std::string str(xOutputContent.data());
  39.  
  40. return xApplication.exec();
To copy to clipboard, switch view to plain text mode 
I expect the following result:
<folder name="root" id="0" is_expanded="false"><folder id="1" name="name"/></folder>
but have the following
<folder name="root" id="" is_expanded=""><folder id="1" name="name"/></folder>
As you can see two of three XPath expressions(<folder name=\"{@name}\" id=\"{@id}\" is_expanded=\"{@is_expanded}\">) weren't executed at all! Does anyone have the experience with such a problem?
All your attempts to help will be appreciated