string handling

Subject: string handling
From: Jeff Lansing <jeff@xxxxxxxx>
Date: Tue, 25 Apr 2000 17:49:37 -0700
Here's an interesting asymetry in how you have to process strings with

<xsl:variable name="string" select="'hyperfitness'"/>

<xsl:variable name="unprefixed-string">
  <xsl:if test="starts-with($string, 'hyper')">
    <xsl:value-of select="substring-after($string, 'hyper')"/>
  <xsl:if test="not(starts-with($string, 'hyper'))">
    <xsl:value-of select="$string"/>

<xsl:variable name="unsuffixed-string"
select="substring-before(concat($string, 'ness'), 'ness')"/>

<xsl:value-of select="concat($unsuffixed-string, ' ',

Of course the idea is not to get null variables when the input string
lacks the prefix/suffix.


 XSL-List info and archive:

Current Thread