« XSLT to trim the string to the last character | Home | Start sqlplus in Windows .BAT script »
XSLT to trim the string
<xsl:template name="trim_string">
<xsl:param name="value"/>
<xsl:param name="len"/>
<xsl:param name="maintain_words" select="'0'"/>
<xsl:variable name="value_no_HTML"><xsl:call-template name="strip_HTML">
<xsl:with-param name="value" select="$value"/>
</xsl:call-template></xsl:variable>
<xsl:choose>
<xsl:when test="$maintain_words = '1'">
<xsl:call-template name="trim_to_last_char">
<xsl:with-param name="value" select="substring($value_no_HTML,0,(5 + $len))"/>
<xsl:with-param name="search_char" select="' '"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring($value_no_HTML,0,$len)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:param name="value"/>
<xsl:param name="len"/>
<xsl:param name="maintain_words" select="'0'"/>
<xsl:variable name="value_no_HTML"><xsl:call-template name="strip_HTML">
<xsl:with-param name="value" select="$value"/>
</xsl:call-template></xsl:variable>
<xsl:choose>
<xsl:when test="$maintain_words = '1'">
<xsl:call-template name="trim_to_last_char">
<xsl:with-param name="value" select="substring($value_no_HTML,0,(5 + $len))"/>
<xsl:with-param name="search_char" select="' '"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring($value_no_HTML,0,$len)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Topics: XSLT | Submitter: admin
Comments
You must be logged in to post a comment.