xsl sort ?????
I am desparately trying to find a way to sort an xml doc NOT ONLY by title but by somehow passing over the "The" in the title...
I have been looking extensively on the web and can't seem to find anything...
Is there a way to do this?
Here is the xsl file:
<xsl:for-each order-by="+title" select="book" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:value-of select="category" />
<xsl:value-of select="title" />
<xsl:value-of select="author" />
ANY suggestions or comments are welcome!
I don't have an answer for you, exactly. I'm still working through some novice/intermediate XSLT stuff, myself, but the resource I've been working through (Inside XSLT, Steve Holzner) is an excellent reference and has a section on string handling functions in XSL. I'll try to give an example of something he has in the book which may be applicable and maybe you can cross-reference it with an online resource like W3 or something.
Note the above code will not work, specifically the contents of the value-of element and the syntax of the select attribute. I'm not sure text() is required. Mainly use it as a jumping off point. Sorry I don't have a more complete answer, but hopefully it will get you started.
<xsl:template match="text()[starts-with(., 'The ')]">
<xsl:value-of select="text()[substring-after('wherever you can get the title', 'The ')]"/>
Thanks for your help!,
After looking into string manipulation...I have decided to go the simplistic route and simply add an "alphaIndex" element to the nodes (where the keyword is specified) then order-by the "alphaIndex".
This works fine but feels a little clunky and not very elegant...
This is the first time I have played around with xml...it sounded so INTIMIDATING but, there's really not much to the xml itself, huh?