[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Strings Comparison Question.

Subject: Re: Strings Comparison Question.
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 16 Jan 2003 12:52:24 -0800 (PST)
xsl if string compare
For a string-comparison snippet see:

http://www.topxml.com/code/default.asp?p=3&id=v20010205033413&ms=20&l=xpath&sw=lang



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL



"Patel, Viral" <viral.patel@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:7C1965B54EADD61190B80008023D05F4790C9C@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Sorry if you get duplicates but I got some email transmission error
so I am
> gonna post this problem one more time and see if someone can help me.
> 
> 
> I am new to XSL and I have several questions - some of them might be
really
> easy ones but I just want to confirm.
> 
> 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?
> 
> 
> 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.
> 
> How would I go about doing this?  And the those non-alphabetic
characters
> are not fixed, they could vary depending on the XML file used.  If
there was
> string comparison allowed then I could do something like @name<'a' or
> @name>'z'  for each node and that would give me all non-alphabetic
> characters.
> 
> Any ideas/help/suggestions would be greatly appreciated.
> 
> Thanks
> 
> 
> <record>
>  <community name="101 South">
>   ... Some Information ...
>  </community>
>  <community name="**">
>   ... Some Information ...
>  </community>
>  <community name="Adams">
>   ... Some Information ...
>  </community>
>  <community name="Smith">
>   ... Some Information ...
>  </community>
>  ... .... ....
> </record>
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.1" xmlns:lxslt="http://xml.apache.org/xslt">
> 
>       <xsl:template match="/">
>  <xsl:apply-templates match="//community"/>
>       </xsl:template>
> 
>  <xsl:template name="community">
>   <xsl:if test="starts-with(@name,'*')">
>    <xsl:call-template
> name="createTopLetterLinkForCommunity">
>     <xsl:with-param
> name="letterLink">*</xsl:with-param>
>    </xsl:call-template>
>   </xsl:if>
>   <xsl:if test="starts-with(@name,'A')">
>    <xsl:call-template
> name="createTopLetterLinkForCommunity">
>     <xsl:with-param
> name="letterLink">A</xsl:with-param>
>    </xsl:call-template>
>   </xsl:if>
>   <xsl:if test="starts-with(@name,'B')">
>    <xsl:call-template
> name="createTopLetterLinkForCommunity">
>     <xsl:with-param
> name="letterLink">B</xsl:with-param>
>    </xsl:call-template>
>   </xsl:if>
>   <xsl:if test="starts-with(@name,'C')">
>    <xsl:call-template
> name="createTopLetterLinkForCommunity">
>     <xsl:with-param
> name="letterLink">C</xsl:with-param>
>    </xsl:call-template>
>   </xsl:if>
>   <xsl:if test="starts-with(@name,'D')">
>    <xsl:call-template
> name="createTopLetterLinkForCommunity">
>     <xsl:with-param
> name="letterLink">D</xsl:with-param>
>    </xsl:call-template>
>   </xsl:if>
>        .... AND SO ON ....
>  </xsl:template>
> 
> </xsl:stylesheet>
> 
> 
> 
> 
> Thanks
> V. Patel.
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Strings Comparison Question.
    • Patel, Viral - Thu, 16 Jan 2003 11:13:12 -0500 (EST)
      • <Possible follow-ups>
      • Dimitre Novatchev - Thu, 16 Jan 2003 15:51:57 -0500 (EST) <=
        • Laura - Thu, 16 Jan 2003 15:59:57 -0500 (EST)
          • J.Pietschmann - Thu, 16 Jan 2003 16:17:15 -0500 (EST)
          • Laura - Thu, 16 Jan 2003 16:43:17 -0500 (EST)
          • bryan - Fri, 17 Jan 2003 04:09:04 -0500 (EST)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.