-1

I need to replace a single quote to double quotes.

For example: input = Ram's

So i need a output as Ram''s

How to do in xslt 1.0? Please help me!

PRADEEP N
  • 49
  • 9

1 Answers1

0

Its working for me!

  <xsl:template match="name">
  <xsl:copy>
  <xsl:call-template name="replace">
  <!--  Here getting the replaced values -->
  <xsl:with-param name="text" select="."/>

  </xsl:call-template>
  </xsl:copy>
  </xsl:template>

  <xsl:template name="replace">
  <xsl:param name="text"/>
  <xsl:param name="searchString">'</xsl:param>
  <xsl:param name="replaceString">''</xsl:param>
  <xsl:choose>
  <xsl:when test="contains($text,$searchString)">
  <xsl:value-of select="substring-before($text,$searchString)"/>
  <xsl:value-of select="$replaceString"/>
  <!--  recursive call -->
  <xsl:call-template name="replace">
  <xsl:with-param name="text" select="substring-after($text,$searchString)"/>
  <xsl:with-param name="searchString" select="$searchString"/>
  <xsl:with-param name="replaceString" select="$replaceString"/>
  </xsl:call-template>
  </xsl:when>
  <xsl:otherwise>
  <xsl:value-of select="$text"/>
  </xsl:otherwise>
  </xsl:choose>
  </xsl:template>
PRADEEP N
  • 49
  • 9
  • Its helped me michael.hor257k answer! [michael.hor257k - Answer](http://stackoverflow.com/questions/30339128/how-to-replace-single-quote-to-double-single-quote-in-xslt) – PRADEEP N Sep 14 '16 at 10:16