Extracting the first two initials of a person's name
I think you should be able to get rid of the replace() by testing the position of the token in an additional predicate. 

You should also be able to remove the string-join() (unless you don't want spaces between the initials).

You can also remove the string-length() test by adjusting the regex for -.

New function based on above suggestions:

&lt;xsl:function name="pull_it:get_initials"&gt;
  &lt;xsl:param name="names"/&gt;
  &lt;xsl:value-of select="
    for $token in tokenize($names,'(-+|\s+)')[2 &gt;= position()]
    return concat(substring($token,1,1),'.')
    "/&gt;
&lt;/xsl:function&gt;


Complete example (used Saxon-HE 9.5 to test)...

XML Input (Added test VI)

&lt;doc&gt;
    &lt;name&gt;
        &lt;surname&gt;Test I&lt;/surname&gt;
        &lt;given-names&gt;Chris&lt;/given-names&gt;
    &lt;/name&gt;
    &lt;name&gt;
        &lt;surname&gt;Test II&lt;/surname&gt;
        &lt;given-names&gt;Chris Chris&lt;/given-names&gt;
    &lt;/name&gt;
    &lt;name&gt;
        &lt;surname&gt;Test III&lt;/surname&gt;
        &lt;given-names&gt;Chris Eat Meat&lt;/given-names&gt;
    &lt;/name&gt;
    &lt;name&gt;
        &lt;surname&gt;Test IV&lt;/surname&gt;
        &lt;given-names&gt;Chris-Eat Meat&lt;/given-names&gt;
    &lt;/name&gt;
    &lt;name&gt;
        &lt;surname&gt;Test V&lt;/surname&gt;
        &lt;given-names&gt;Chris-Eat-Meat&lt;/given-names&gt;
    &lt;/name&gt;
    &lt;name&gt;
        &lt;surname&gt;Test VI&lt;/surname&gt;
        &lt;given-names&gt;Chris---Eat----Meat&lt;/given-names&gt;
    &lt;/name&gt;
&lt;/doc&gt;


XSLT 2.0

&lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:pull_it="pull_it"
  exclude-result-prefixes="pull_it"&gt;
  &lt;xsl:output indent="yes"/&gt;
  &lt;xsl:strip-space elements="*"/&gt;

  &lt;xsl:function name="pull_it:get_initials"&gt;
    &lt;xsl:param name="names"/&gt;
    &lt;xsl:value-of select="
      for $token in tokenize($names,'(-+|\s+)')[2 &gt;= position()]
      return concat(substring($token,1,1),'.')
      "/&gt;
  &lt;/xsl:function&gt;

  &lt;xsl:template match="@*|node()"&gt;
    &lt;xsl:copy&gt;
      &lt;xsl:apply-templates select="@*|node()"/&gt;
    &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="name"&gt;
    &lt;xsl:copy&gt;
      &lt;xsl:apply-templates select="@*|node()"/&gt;
      &lt;initials&gt;&lt;xsl:value-of select="pull_it:get_initials(given-names)"/&gt;&lt;/initials&gt;
    &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;


XML Output

&lt;doc&gt;
   &lt;name&gt;
      &lt;surname&gt;Test I&lt;/surname&gt;
      &lt;given-names&gt;Chris&lt;/given-names&gt;
      &lt;initials&gt;C.&lt;/initials&gt;
   &lt;/name&gt;
   &lt;name&gt;
      &lt;surname&gt;Test II&lt;/surname&gt;
      &lt;given-names&gt;Chris Chris&lt;/given-names&gt;
      &lt;initials&gt;C. C.&lt;/initials&gt;
   &lt;/name&gt;
   &lt;name&gt;
      &lt;surname&gt;Test III&lt;/surname&gt;
      &lt;given-names&gt;Chris Eat Meat&lt;/given-names&gt;
      &lt;initials&gt;C. E.&lt;/initials&gt;
   &lt;/name&gt;
   &lt;name&gt;
      &lt;surname&gt;Test IV&lt;/surname&gt;
      &lt;given-names&gt;Chris-Eat Meat&lt;/given-names&gt;
      &lt;initials&gt;C. E.&lt;/initials&gt;
   &lt;/name&gt;
   &lt;name&gt;
      &lt;surname&gt;Test V&lt;/surname&gt;
      &lt;given-names&gt;Chris-Eat-Meat&lt;/given-names&gt;
      &lt;initials&gt;C. E.&lt;/initials&gt;
   &lt;/name&gt;
   &lt;name&gt;
      &lt;surname&gt;Test V&lt;/surname&gt;
      &lt;given-names&gt;Chris---Eat----Meat&lt;/given-names&gt;
      &lt;initials&gt;C. E.&lt;/initials&gt;
   &lt;/name&gt;
&lt;/doc&gt;