|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Strings Comparison Question.
Hi Viral,
At 11:13 AM 1/16/2003, you wrote: 1. Is it possible to compare two strings lexicographically in XSL/XPATH? I believe the answer is no. Is there a way I can achieve this? You are correct, the answer is no; XSLT runs up against internationalization / localization requirements here that are hard or impossible to specify in the general case. Its support of extension functions is precisely to help developers bridge this gap. 2. I have listed the XML & XSL below. In that the community name attribute could start with a alphabet, a number or any other character. Most of the community names are expected to start with alphabets. In my output, if I have one or more community name starting with a certain alphabet (i.e. 'A') then I want to put a link (aka advance orgranizer) at the top of the page that would say 'A' and likewise for all the alphabets. Also since I have few communities starting with non-alphabets, I would want to put a link called Miscellaneous that would link to a page which would display all non-alphabetic characters. This is problem is complex enough that it may require multiple passes. It basically amounts to a large sorting / grouping problem. But as a start, below your code <xsl:if test="starts-with(@name,'*')">
<xsl:call-template name="createTopLetterLinkForCommunity">
<xsl:with-param name="letterLink">*</xsl:with-param>
</xsl:call-template>
</xsl:if>could certainly be pulled out into a template to be called with a parameter of its own (or even rolled into the 'createTopLetterLink' template). In lieu of hard-coding, you can identify the characters you need to send in as parameters by iterating over your data and using grouping logic (e.g. the Muenchian method -- see the archives) to de-duplicate. (The necessity of doing this is why multiple passes, or the node-set extension function, will be necessary.) Check the list archives, the XSL FAQ or www.jenitennison.com for more on grouping. I know this isn't a full solution, but maybe it's enough to get you rolling again. Cheers, Wendell
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








