I. Here is an easy and natural XSLT 2.0 solution:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/*/*">
<xsl:value-of separator=", " select=
"substring-before(., ',')
, for $n in tokenize(substring-after(., ','), '\s')[.]
return
substring($n, 1,1)
"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
When this transformation is applied on the following XML document:
<t xmlns:dc="some:dc">
<dc:creator >Friend, Natasha</dc:creator>
<dc:creator>Tolkien, J. R. R.</dc:creator>
</t>
the wanted, correct result is produced:
Friend, N
Tolkien, J., R., R.
II. An XSLT 1.0 solution:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/*/*/text()">
<xsl:value-of select="substring-before(., ',')"/>
<xsl:call-template name="replaceTokenDelims">
<xsl:with-param name="pStr" select=
"concat(normalize-space(substring-after(., ',')), ' ')"/>
<xsl:with-param name="pToken" select="' '"/>
<xsl:with-param name="pReplacement" select="', '"/>
</xsl:call-template>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template name="replaceTokenDelims">
<xsl:param name="pStr"/>
<xsl:param name="pToken"/>
<xsl:param name="pReplacement"/>
<xsl:if test="$pStr">
<xsl:value-of select="$pReplacement"/>
<xsl:value-of select=
"substring(substring-before($pStr, $pToken), 1, 1)"/>
<xsl:call-template name="replaceTokenDelims">
<xsl:with-param name="pStr"
select="substring-after($pStr, $pToken)"/>
<xsl:with-param name="pToken" select="$pToken"/>
<xsl:with-param name="pReplacement" select="$pReplacement"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
When this transformation is applied on the same XML document (above), again the same correct result is produced:
Friend, N
Tolkien, J., R., R.