From: "Mirick, John" <jmirick@xxxxxxxxxxxx>
To: "'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: looking for the / char
Date: Fri, 2 Feb 2001 14:52:48 -0500
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: text/plain;
charset="iso-8859-1"
Eck! Im a bit baffled right now...
Im trying to get a template that will just remove spaces and / from a given
string. The code is based on some I found in the FAQ. It replaces the spaces
fine.... however it wont replace the /.... Im not sure why.
If anyone has a spare moment Im sure it is blatantly obvious to some of you.
But Im at the point where Im ready to pull my hair out. I have also tried
both the decimal and hex codes (/ and /) rather than just using the
slash with no luck.
-john
<xsl:template name="replaceCharsInString">
<xsl:param name="stringIn"/>
<xsl:choose>
<xsl:when test="contains($stringIn,' ')">
<xsl:value-of
select="concat(substring-before($stringIn,' '),'%20')"/>
<xsl:call-template name="replaceCharsInString">
<xsl:with-param name="stringIn"
select="substring-after($stringIn,' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($stringIn,'/')">
<xsl:message>2</xsl:message>
<xsl:value-of
select="concat(substring-before($stringIn,'/'),'%2f')"/>
<xsl:call-template name="replaceCharsInString">
<xsl:with-param name="stringIn"
select="substring-after($stringIn,'/')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$stringIn"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|