|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Hmmmm.... translate function
> that won't work with his example
>If @div = "12 All +" you'll get:
>12 All %12 All 212 All B
>And what he wants is:
>12 All %2B
You're right Americo. This will work (I'm sure someone's already done one
of these somewhere on the FAQ. Just a good exercise) using his + to %2B
requirements....
Jeff
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<!-- test replaceString template -->
<xsl:call-template name="replaceString">
<xsl:with-param name="original"
select="'One+Flew+Over+The+Cuckoos+Nest'"/>
<xsl:with-param name="find" select="'+'"/>
<xsl:with-param name="replace" select="'%2B'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="replaceString">
<xsl:param name="original" select="string('')"/>
<xsl:param name="find" select="string('')"/>
<xsl:param name="replace" select="string('')"/>
<xsl:choose>
<xsl:when test="contains($original, $find)">
<xsl:call-template name="replaceString">
<xsl:with-param name="original"
select="concat(substring-before($original, $find),$replace,
substring-after($original, $find))"/>
<xsl:with-param name="find" select="$find"/>
<xsl:with-param name="replace" select="$replace"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$original"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








