Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-1368

multiple key definitions (same name) do not work as expected on longer strings

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.4
    • 2.7
    • Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects. Anybody can view the issue.)
    • None
    • Operating System: Other
      Platform: Other
    • PatchAvailable

    Description

      At the weekend we found a problem in Cocoon 2.1 (CVS head) using the used Xalan
      2.4.1 and XSLTC there
      (http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=103985066026426&w=2).

      The files used for the tests were
      xml-cocoon2\src\webapp\samples\flow\examples\prefs\pages\userInfo.xsp
      and version 1.5
      http://cvs.apache.org/viewcvs.cgi/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/jpath.xsl
      I will attach simplified versions of both files.

      In the XSL there was a aggregated key declaration (or how is it called?):

      <xsl:key name="JPathExprs" match="jpath:if" use="@test"/>
      <xsl:key name="JPathExprs" match="jpath:when" use="@test"/>
      <xsl:key name="JPathExprs" match="jpath:for-each" use="@select"/>
      <xsl:key name="JPathExprs" match="jpath:value-of" use="@select"/>

      When applying templates like

      <xsl:apply-templates select="//jpath:if | //jpath:when | //jpath:value-of |
      //jpath:for-each"/>

      and using a template like

      <xsl:template match="jpath:if | jpath:when | jpath:for-each | jpath:value-of">
      <tr>
      <td>
      <xsl:value-of select="name()"/>
      </td>
      <td>
      <xsl:value-of select="concat(@test, @select)"/>
      </td>
      <td>
      <xsl:value-of select="generate-id()"/>
      </td>
      <td>
      <xsl:value-of select="generate-id(key('JPathExprs', concat(@test,
      @select)))"/>
      </td>
      <td>
      <xsl:value-of select="count(key('JPathExprs', concat(@test,
      @select)))"/>
      </td>
      </tr>
      </xsl:template>

      the generate-id() and the count() return wrong values for strings like "check
      and firstName = ''". The generate-id() return is empty and the count() return is
      0. But as you can guess those expressions are important for Muenchian Grouping.

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--test.xml
          0.8 kB
          Jörg Heinicke
        2. ASF.LICENSE.NOT.GRANTED--test.xsl
          1 kB
          Jörg Heinicke
        3. patch.j1368.txt
          4 kB
          Henry Zongaro

        Issue Links

          Activity

            People

              Unassigned Unassigned
              joerg.heinicke@gmx.de Jörg Heinicke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: