View Full Version : truncate the .com in a string

03-31-2010, 09:38 PM
ok here we go

I have this var

<xsl:variable name="reseller" select="/response/parameters/currentpath/level[id=2]/name"/>

it returns either "example" or "example.com"

I am displaying an img based on what is coming back

<xsl:if test="$reseller != 'example'">
<img src="Styles/Intercall/images/poweredby.png" />

as you can see my problem is tha sometimes i receive example and sometimes example.com

I need a way to truncate the .com if it gets returned at all in the var below

<xsl:variable name="reseller" select="/response/parameters/currentpath/level[id=2]/name"/>


03-31-2010, 10:54 PM
after much time and many head poundings on the desk I got this to work. code below incase anyone needs help

<xsl:variable name="resellerName" select="/response/parameters/currentpath/level[id=2]/name"/>
<xsl:variable name="reseller">
<xsl:when test="contains($resellerName,'.')">
<xsl:value-of select="substring-before($resellerName,'.')" />
<xsl:value-of select="$resellerName"/>