removing_duplicated_data_xslt2.0

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template name="distinct-values-from-list"> <xsl:param name="list"/> <xsl:param name="delimiter" select="'|'"/> <xsl:choose> <xsl:when test="contains($list, $delimiter)"> <xsl:variable name="token" select="substring-before($list, $delimiter)" /> <xsl:variable name="next-list" select="substring-after($list, $delimiter)" /> <!-- output token if it is unique --> <xsl:if test="not(contains(concat($delimiter, $next-list, $delimiter), concat($delimiter, $token, $delimiter)))"> <xsl:value-of select="concat($token, $delimiter)"/> </xsl:if> <!-- recursive call --> <xsl:call-template name="distinct-values-from-list"> <xsl:with-param name="list" select="$next-list"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$list"/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
XSLT 2.0 to omit duplicate value on a comma-separated string

INPUT :- <input>asdf,asdf,weqt,fd,asdf,asdf</input>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.