Nic Miloslav     Example 49    KEYWORDS      EXAMPLES      AUTHORS     

The translate function returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string. If a character occurs more than once in second argument string, then the first occurrence determines the replacement character. If the third argument string is longer than the second argument string, then excess characters are ignored.


     XML     HOME     XSL 1      
<xslTutorial >
<text>goose</text>
</xslTutorial>

     XSL 1     HOME     XML     HTML 1     OUTPUT 1     
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:template match="/">
<P><xsl:value-of select="//text"/></P>
<P><xsl:value-of select="translate(//text,'egos','EGOS')"/></P>
<P><xsl:value-of select="translate(//text,'se','d')"/></P>
<P><xsl:value-of select="translate(//text,'gseo','bad')"/></P>
<P><xsl:value-of select="translate(//text,'gseg','bksC')"/></P>
</xsl:template>
</xsl:stylesheet>

     HTML 1     HOME     XML     XSL 1     OUTPUT 1     
<HTML>
<HEAD> </HEAD>
<BODY>
<P>goose</P>
<P>GOOSE</P>
<P>good</P>
<P>bad</P>
<P>books</P> </BODY> </HTML>

     OUTPUT 1     HOME     XML     XSL 1     HTML 1     

goose

GOOSE

good

bad

books