Try this one with 2.0:<?xml version="1.0" ?><xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"> <XML> <xsl:apply-templates/> </XML></xsl:template> <xsl:template match="TAG1 | TAG2"> <LINE> <xsl:analyze-string select="text()" regex="([a-zA-Z0-9]+)("> <xsl:matching-substring> <xsl:choose> <xsl:when test=".[position() = 1]"> <TAG1><xsl:value-of select="replace(.,';','')"/></TAG1> </xsl:when> <xsl:when test=".[position() = last()]"> <TAG2><xsl:value-of select="replace(.,';','')"/></TAG2> </xsl:when> <xsl:otherwise> <TAG1><xsl:value-of select="replace(.,';','')"/></TAG1> </xsl:otherwise> </xsl:choose> </xsl:matching-substring> <xsl:non-matching-substring> <TAG2><xsl:value-of select="replace(.,';','')"/></TAG2> </xsl:non-matching-substring> </xsl:analyze-string> </LINE> </xsl:template></xsl:stylesheet>