I have written code here for split the text in xsl. might be this is helpfull to you.
this is a function that split the string and print here..
<xsl:template name="SplitText">
<xsl:param name="inputString"/>
<xsl:param name="delimiter"/>
<xsl:choose>
<xsl:when test="contains($inputString, $delimiter)">
<xsl:value-of select="substring-before($inputString,$delimiter)"/>
<xsl:text disable-output-escaping = "no">
</xsl:text>
<xsl:call-template name="SplitText">
<xsl:with-param name="inputString" select="substring-after($inputString,$delimiter)"/>
<xsl:with-param name="delimiter" select="$delimiter"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$inputString != ''">
<xsl:value-of select="$inputString"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Here i have call the parent method with two parameters
1. Input string (Full string)
2. Delimiter (Split by char string)
In My example i have pass varModuleId that is some number with are separated by comma, which i need to split and use in code might be this will helpful to all
==================================
<xsl:call-template name="SplitText">
<xsl:with-param name="inputString" select="$varModuleId"/>
<xsl:with-param name="delimiter">,</xsl:with-param>
<!--<xsl:with-param name="delimiter" select="$delimiter"/>-->
</xsl:call-template>
No comments:
Post a Comment