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=16851>. 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=16851 Bug in xsl:sort for content with spaces Summary: Bug in xsl:sort for content with spaces Product: XalanJ2 Version: 2.4 Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: Xalan-CmdLine AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Given... <NameList> <Record><Name>A</Name></Record> <Record><Name>AAL</Name></Record> <Record><Name>Amanda</Name></Record> <Record><Name>Amy</Name></Record> <Record><Name>A Maureen</Name></Record> </NameList> ...and applying the following stylesheet... <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes"/> <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/> <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> <xsl:template match="NameList"> <xsl:comment><xsl:value-of select="system-property('xsl:vendor')"/> </xsl:comment> <table> <xsl:apply-templates select="Record"> <xsl:sort select="translate(Name, $lower, $upper)"/> </xsl:apply-templates> </table> </xsl:template> <xsl:template match="Record"> <tr><td><xsl:value-of select="Name"/></td></tr> </xsl:template> </xsl:stylesheet> I get... <!--Apache Software Foundation-- ><table> <tr> <td>A</td> </tr> <tr> <td>AAL</td> </tr> <tr> <td>Amanda</td> </tr> <tr> <td>A Maureen</td> </tr> <tr> <td>Amy</td> </tr> </table> ...using xalan, and (for example)... <!--SAXON 6.4.1 from Michael Kay--><table> <tr> <td>A</td> </tr> <tr> <td>A Maureen</td> </tr> <tr> <td>AAL</td> </tr> <tr> <td>Amanda</td> </tr> <tr> <td>Amy</td> </tr> </table> ...using saxon. It looks like xalan is removing the space between "A" and "Maureen", causing it to sort below Amanda. It looks like a bug to me. Workaround: If I replace my upper and lower variables with... <xsl:variable name="lower" select="' abcdefghijklmnopqrstuvwxyz'"/> <xsl:variable name="upper" select="'_ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> ...it works as expected.
