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

QtXmlPatterns: XPath expression specifying number of element to match does not work with XSLT2

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.11.0 Beta 1
    • Fix Version/s: None
    • Component/s: XML: QtXmlPatterns
    • Labels:
      None
    • Environment:
      All

      Description

      For an XML file like

      <?xml version="1.0" ?>
      <description>description
          <para>Paragraph number 1</para>
          <para>Paragraph number 2</para>
          <para>Paragraph number 3</para>
      </description>
      

      the style sheet

      <?xml version="1.0" encoding="UTF-8" ?>
      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
      <xsl:template match="/description/para[3]">
      &lt;para>Modify paragraph #3&lt;/para>
      </xsl:template>
      <xsl:template match="/">
          <xsl:apply-templates />
      </xsl:template>
      </xsl:stylesheet>
      

      running:

      xmlpatterns test.xsl test.xml
      
      --> 
      
      description
          Paragraph number 1
          Paragraph number 2
          Paragraph number 3
      

      whereas

      xalan -xsl test.xsl  -in test.xml
      
      -->
      
      <?xml version="1.0" encoding="UTF-8"?>description
          Paragraph number 1
          Paragraph number 2    
      &lt;para&gt;Modify paragraph #3&lt;/para&gt;
      

      Note though when using XPATH query mode with the query

      description/para[3]
      

      running

       xmlpatterns test.xq test.xml 
      -->
      <para>Paragraph number 3</para>
      

      the paragraph is matched correctly.

        Attachments

          Issue Links

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

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                kleint Friedemann Kleint
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes