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

sort then calling position() in xsl give original indices.

    XMLWordPrintable

    Details

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

      Description

      below are the test xml and xsl
      xml:

      <?xml version="1.0"?>
      <?xml-stylesheet type="text/xsl" href="test.xsl"?>
      <library>
        <book><name>abc</name></book>
        <book><name>def</name></book>
        <book><name>aaa</name></book>
      </library>
      

      xsl

      <?xml version="1.0" ?>
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:template match="/">
          <xsl:for-each select="/library/book">
            <xsl:sort select="name" data-type="text" />
            <xsl:value-of select="position()" />: <xsl:value-of select="name" /> 
          </xsl:for-each>
        </xsl:template>
      </xsl:stylesheet>
      

      With online testtools like 'http://www.xsltcake.com/', you get the proper poistion but with qt it gives old(original indices only). which is wrong.

      correct output(with online testtools)
      1: aaa 
      2: abc 
      3: def 
      
      wrong output(with Qt)
      3: aaa 
      1: abc 
      2: def 
      

      I tried same with 'xmlpatterns'(from shell prompt), it gives same wrong result as with Qt Application.

      expected:
      after sorting, it(position()) should return sequenced indices after sort.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              santforyou@gmail.com santosh chauhan
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes