XSLT 예제 : translate() 함수

translate() Function



  • translate('abcd', 'abc', 'ABC') = ABCd
  • translate('cba', 'abcdefg', 'ABCDEFG') = CBA
  • translate(' 모든 공백 제거 ', ' ', '') = 모든공백제거

--------------------------------------------------------------------------------------


<?xml version="1.0" encoding="euc-kr"?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
 <h3>translate() Function</h3>
 <ul>
 <li><b>translate('abcd', 'abc', 'ABC')</b> =
 <xsl:value-of select="translate('abcd', 'abc', 'ABC')"/></li>
 <li><b>translate('cba', 'abcdefg', 'ABCDEFG')</b> =
 <xsl:value-of select="translate('cba', 'abcdefg', 'ABCDEFG')"/></li>
 <li><b>translate(' 모든 공백 제거 ', ' ', '')</b> =
 <xsl:value-of select="translate(' 모든 공백 제거 ', ' ', '')"/></li>
 </ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>