XSL Replace with multiple values without duplications

I’m trying to filter and then replace umlauts in a file name. Unfortunately this doesn’t really work, because if all three umlauts are included, the variable name is also written several times in the filename.

<xsl:choose>
<xsl:when test="contains($name,'ä') or contains($name,'ö') or contains($name,'ü')">
<xsl:value-of select="replace($name, 'ä', 'ae'),replace($name,'ö','oe'),replace($name, 'ü', 'ue') " />
</xsl:when>

No matter what I try, either it just replaces an umlaut, or I have multiple times the filename after the transformation.
When I try to create a nested replace where the variable occurs only once, the file cannot be saved without errors….
Does anyone of you have an idea how I have only once the name in the filename, but all umlaut are replaced?

>Solution :

Try:

<xsl:value-of select="replace(replace(replace($name, 'ä', 'ae'),'ö','oe'), 'ü', 'ue')"/>

Leave a Reply