XSLT : Remove Accentuated characters. (Translate German/Danish characters)

Strip all accentuated characters

Remove All accentuated chartacters (Oracle replacement tables)[https://docs.oracle.com/cd/F49540_01/DOC/inter.815/a67843/aspell.htm]

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20

  <xsl:value-of select="fer:normalize-names(current/name)"/>

  <!-- This function is aimed to transform all special characters from German, Swedish and Danish to non-accentuated characters.-->
  <xsl:function name="fer:normalize-names" as="xs:string?">
    <xsl:param name="input" as="xs:string?"/>
    <xsl:if test="not(empty($input))">
      <xsl:variable name="replaced_ae" select="replace($input,'[äæ]', 'ae')"/>
      <xsl:variable name="replaced_ue" select="replace($replaced_ae,'[ü]', 'ue')"/>
      <xsl:variable name="replaced_oe" select="replace($replaced_ue,'[öø]', 'oe')"/>
      <xsl:variable name="replaced_AE" select="replace($replaced_oe,'[ÄÆ]', 'AE')"/>
      <xsl:variable name="replaced_UE" select="replace($replaced_AE,'[Ü]', 'UE')"/>
      <xsl:variable name="replaced_OE" select="replace($replaced_UE,'[ÖØ]', 'OE')"/>
      <xsl:variable name="replaced_aa" select="replace($replaced_OE,'[å]', 'aa')"/>
      <xsl:variable name="replaced_AA" select="replace($replaced_aa,'[Å]', 'AA')"/>
      <xsl:variable name="replaced_ss" select="replace($replaced_AA,'[ß]', 'ss')"/>
      <xsl:value-of select="normalize-space(replace(normalize-unicode($replaced_ss,'NFKD'),'[^(A-Za-z\-\s)]',''))"/>
    </xsl:if>
  </xsl:function>
</xsl:stylesheet>