Possible Duplicate:
Ignoring 'A' and 'The' when sorting with XSLT
I have a list of places, however some of theses places have the word ‘the’ in front. I need help in sorting these places in alphabetical order by discarding the ‘the’. eg the mountains, should be just mountains. i can strip out the word ‘the’ to display the name by using substring however the sort doesn’t seem to be able to read this.
I have this so far.
<xsl:sort data-type="text" order="ascending" select="@places" />
example of what comes back:
alpha
sigma
the beta
would like it to come back with:
alpha
beta
sigma
this is just an example of how i stripped it from the name:
<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>
Use:
Note: You could also use
translate()function for case-insensitivity.