Hi All,
I am trying to replace string in XSLT in a .net Application.
Below is the Code how i am trying to replace it :
Template for replacing the String
Code:
"<xsl:template name="stringreplace">"
" <xsl:param name="text"/>"
" <xsl:param name="replace"/>"
" <xsl:param name="by"/>"
" <xsl:choose>"
" <xsl:when test="contains($text, $replace)">"
" <xsl:value-of select="substring-before($text,$replace)"/>"
" <xsl:value-of select="$by"/>"
" <xsl:call-template name="stringreplace">"
" <xsl:with-param name="text" select="substring-after($text,$replace)"/>"
" <xsl:with-param name="replace" select="$replace"/>"
" <xsl:with-param name="by" select="$by"/>"
" </xsl:call-template>"
" </xsl:when>"
" <xsl:otherwise>"
" <xsl:value-of select="$text"/>"
" </xsl:otherwise>"
" </xsl:choose>"
"</xsl:template>"
Here i am calling the above template :
Code:
<xsl:call-template name="stringreplace">
" <xsl:with-param name="text" select=sAttValue/>
" <xsl:with-param name="replace" select="'</><>'"/>
" <xsl:with-param name="by" select="'|'"/>
" </xsl:call-template>
The value In the variable is sAttValue = " <>3333</><>4444</><>5555</> "
what i am doing is replacing '<></>' with '|' and i am getting remaing string is
<>3333|4444|5555</>.
Now i want want to replace <> and </> with blank value so i vl get
3333|4444|5555
Any Idea How can i do that ?? where can i modify in the template or how to call template again to pass new value for replacing.
Thanks
-Nelly