You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/10/10 21:24:50 UTC
DO NOT REPLY [Bug 13508] New: -
Strips space before sorting datatype="text".
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=13508>.
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=13508
Strips space before sorting datatype="text".
Summary: Strips space before sorting datatype="text".
Product: XalanJ2
Version: 2.4
Platform: PC
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Xalan
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: graeme.st.clair@hds.com
XALAN seems to strip space out of an element before sorting on it. XSLT 3.4
says "Initially, the set of whitespace-preserving element names contains all
element names." I am not using either strip- or preserve-space.
Source XML:
<?xml version = "1.0" encoding="ISO-8859-1"?>
<!DOCTYPE musiccollection SYSTEM "music.dtd">
<musiccollection>
<album medium="CD">
<title>Kuijken et al</title>
<entry>
<composer>Boccherini</composer>
<title>Sonata, Cello</title>
<catalog>G 6</catalog>
<key>C</key>
</entry>
<entry>
<composer>Boccherini</composer>
<title>Sonata, Cello</title>
<catalog>G 4</catalog>
<key>A</key>
</entry>
<entry>
<composer>Boccherini</composer>
<title>Sonata, Cello</title>
<catalog>G 17</catalog>
<key>C</key>
</entry>
</album>
</musiccollection>
Original XSL:
<?xml version = "1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:key name="composernames" match="entry" use="substring(composer,1,1)"/>
<xsl:template match="/">
<html>
<body>
<table border="1">
<colgroup span="2" width="17%"/>
<colgroup span="4" width="6%"/>
<colgroup span="2" width="21%"/>
<xsl:for-each select=
"//entry[generate-id(.)=generate-id(key('composernames', substring
(composer,1,1))[1])]">
<xsl:sort select="composer"/>
<xsl:for-each select="key('composernames', substring(composer,1,1))">
<xsl:sort data-type="text" order="ascending" select="composer"/>
<xsl:sort data-type="text" order="ascending" select="title"/>
<xsl:sort data-type="text" order="ascending" select="catalog"/>
<xsl:sort data-type="number" order="ascending" select="number"/>
<tr>
<td><xsl:value-of select="composer"/>
</td>
<td><xsl:value-of select="title"/></td>
<td class="number"><xsl:value-of select="number"/></td>
<td><xsl:value-of select="key"/></td>
<td class="number"><xsl:value-of select="opus"/></td>
<td><xsl:value-of select="catalog"/></td>
<td><xsl:value-of select="desc"/></td>
<td>
<xsl:value-of select="parent::node()/title"/>
</td>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Results are sorted on <catalog>, but in the order 17, 4, 6. The included
blanks are intended to produce 4, 6, 17.