home *** CD-ROM | disk | FTP | other *** search
/ MacFormat UK 160 - Disc 2 / MF_UK_160_2.iso / pc / DiscContent / Trials / oxygen / samples / debugger / String functions / sample2.xsl < prev   
Encoding:
Extensible Markup Language  |  2005-07-21  |  1.2 KB  |  27 lines

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--    Category:    String functions
  3.     Sample from Zvon XSLT tutorial (www.zvon.org)  
  4.     Description:    The translate function returns the first argument string with occurrences of characters 
  5.         in the second argument string replaced by the character at the corresponding position in the third argument string. 
  6.         If a character occurs more than once in second argument string, then the first occurrence determines
  7.         the replacement character. If the third argument string is longer than the second argument string, then excess characters are ignored. -->
  8. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  9.     <xsl:template match="/">
  10.         <P>
  11.             <xsl:value-of select="//text"/>
  12.         </P>
  13.         <P>
  14.             <xsl:value-of select="translate(//text,'egos','EGOS')"/>
  15.         </P>
  16.         <P>
  17.             <xsl:value-of select="translate(//text,'se','d')"/>
  18.         </P>
  19.         <P>
  20.             <xsl:value-of select="translate(//text,'gseo','bad')"/>
  21.         </P>
  22.         <P>
  23.             <xsl:value-of select="translate(//text,'gseg','bksC')"/>
  24.         </P>
  25.     </xsl:template>
  26. </xsl:stylesheet>
  27.