Share:|

HI Team,

 

  1. I have designed a simple XSLT to remove the extra empty lines and empty space  in a string. Please use the below during string transformation J

 

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />

  <xsl:template match="@*|node()">

    <xsl:copy>

      <xsl:apply-templates select="@*|node()" />

    </xsl:copy>

  </xsl:template>

  <xsl:template match="value/text()" name="tokenize">

    <xsl:param name="text" select="." />

    <xsl:param name="separator" select="'&#xA;'" />

    <xsl:choose>

      <xsl:when test="not(contains($text, $separator))">

<xsl:value-of select="normalize-space($text)" />

      </xsl:when>

      <xsl:otherwise>

<xsl:value-of select="normalize-space(substring-before($text, $separator))" />

        <xsl:if test="substring-before($text, $separator) != ''">

<xsl:value-of select=" $separator"/>

</xsl:if>

<xsl:call-template name="tokenize">

<xsl:with-param name="text" select="substring-after($text, $separator)" />

</xsl:call-template>

      </xsl:otherwise>

    </xsl:choose>

  </xsl:template>

</xsl:stylesheet>