Here is the stylesheet:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="allowed" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_/'"/>
<xsl:template match="emp">
<xsl:for-each select="name">
<xsl:call-template name="cut-bad-string">
<xsl:with-param name="str" select="."/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="cut-bad-string">
<xsl:param name="str"/>
<xsl:param name="idx" select="1"/>
<xsl:choose>
<xsl:when test="string-length($str) < $idx">
<xsl:value-of select="$str"/>
<br/>
</xsl:when>
<xsl:when test="string-length(normalize-space(translate(substring($str, $idx, 1), $allowed, ''))) = 0">
<xsl:call-template name="cut-bad-string">
<xsl:with-param name="str" select="$str"/>
<xsl:with-param name="idx" select="$idx + 1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring($str, 1, $idx - 1)"/>
<br/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Regards,
Armen