DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24583>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24583

muenchian grouping + sorting with strange effects

           Summary: muenchian grouping + sorting with strange effects
           Product: XalanJ2
           Version: 2.5
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.transformer
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I try to transform the Cocoon Gump descriptor available at
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/gump.xml (simplified version will
be attached) with a stylesheet to a property file as
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/blocks.properties.

In the stylesheet I group the Cocoon blocks (<project name="cocoon-block-xyz">)
depending on their @status. The problem is in the following template:

The stylesheet:

<xsl:key name="status" match="project[starts-with(@name, 'cocoon-block-')]"
use="@status"/>

<xsl:template match="/module">
    <xsl:apply-templates
        select="project[starts-with(@name, 'cocoon-block-')]
                       [count(. | key('status', @status)[1]) = 1]"
        mode="group"/>
</xsl:template>

<xsl:template match="project" mode="group">
--------
    <xsl:apply-templates select="key('status', @status)">
        <xsl:sort select="@name"/>
    </xsl:apply-templates>
</xsl:template>

<xsl:template match="project">
  <xsl:value-of select="@name"/>
  <xsl:text>&#10;</xsl:text>
</xsl:template>

There are 3 different groups ('stable', 'unstable', 'deprecated'), which should
result in 3 lines of -------- as long as the elements of one group are not
sorted. If the above xsl:sort is in use, there are more lines. One further line
is added if the grouping element (i.e. the one returned by key('status',
@status)[1]) is not the first one after sorting. With the gump.xml as it is, you
get 5 lines. If you rename the first project element to cocoon-block-aaaa, you
will only get 4 lines.

This happens with Xalan 2.5.2 and seems to be a regression bug.

Reply via email to