可能重复:
Ignoring 'A' and 'The' when sorting with XSLT
我有一个位置列表,但是其中一些地方的前面有“the”这个词。我需要帮助按字母顺序排列这些位置,丢弃' the‘。这些山,应该只是山。我可以通过使用子字符串删除单词“the”来显示名称,但是排序似乎无法读取。
到目前为止我有这个。
<xsl:sort data-type="text" order="ascending" select="@places" />回来的例子:
alpha
西格玛
贝塔
希望它能带着:
alpha
测试版
西格玛
这只是一个例子,说明了我是如何从名称中删除它的:
<xsl:choose>
<xsl:when test="substring((@places), 0, 4) = 'The'">
<xsl:value-of select="substring(
(@places),
4,
string-length(@places)
)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@places" />
</xsl:otherwise>
</xsl:choose>发布于 2011-04-07 16:40:50
使用:
<xsl:sort select="substring(@places, 5 * starts-with(@places,'the ')" /> 注意事项:您也可以使用translate()函数来区分大小写.
https://stackoverflow.com/questions/5584385
复制相似问题