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

Re: String comparison

Subject: Re: String comparison
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 24 Sep 2010 15:58:43 -0400
Re:  String comparison
Hi,

Many functions in XSLT 2.0 can be written, with less convenience, as named templates in XSLT 1.0 syntax. They probably won't perform as well, but they can work just fine.

So here's Wolfgang's function:

<xsl:template name="trdif">
 <xsl:param name="a" select="''"/>
 <xsl:param name="b" select="''"/>
 <xsl:choose>
   <xsl:when test="string-length($a) = 0 or
                   substring($a,1,1) != substring($b,1,1)">
     <xsl:value-of select="$b"/>
   </xsl:when>
   <xsl:otherwise>
     <xsl:call-template name="trdif">
       <xsl:with-param name="a" select="substring($a,2)"/>
       <xsl:with-param name="b" select="substring($b,2)"/>
     </xsl:call-template>
   </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Note: untested; beware of typos.

Cheers,
Wendell

At 08:31 AM 9/24/2010, Wolfgang wrote:
Functions is only 2.0, sorry.

On 24 September 2010 12:09,  <pankaj.c@xxxxxxxxxxxxxxxxxx> wrote:
> <xsl:function name="wl:trdif">
>  <xsl:param name="a" as="xsd:string"/>
>  <xsl:param name="b" as="xsd:string"/>
>  <xsl:choose>
>    <xsl:when test="string-length($a) = 0 or
>                    substring($a,1,1) != substring($b,1,1)">
>      <xsl:value-of select="$b"/>
>    </xsl:when>
>    <xsl:otherwise>
>      <xsl:value-of select="wl:trdif(substring($a,2),substring($b,2))"/>
>    </xsl:otherwise>
>  </xsl:choose>
> </xsl:function>
>
> Thanks Laun for suggestion, I will look into that.


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread

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.