Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Functions operating on strings (15/15) >

Strings from unicode codepoints

The function string-to-codepoints()Creates a sequence of unicode codepoints corresponding to the characters in the string provided in the argument.

The function codepoints-to-string() performs the reverse operation. It creates a string from a sequence of unicode codepoints.

XSLT

      <xsl:stylesheet
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>

            <xsl:template  match="/aaa">
                  <xxx>
                        <xsl:value-of  select="string-to-codepoints(bbb)"/>
                  </xxx>
                  <yyy>
                        <xsl:value-of  select="codepoints-to-string((72,101,108,108,111))"/>
                  </yyy>
                  <zzz>
                        <xsl:for-each  select="for $a in (1 to 10) return (48+$a*5)">
                              <item  char="{codepoints-to-string(.)}"
                                          code="{.}"/>
                        </xsl:for-each>
                  </zzz>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>
            <bbb>Hello</bbb>
      </aaa>
Output

      <xxx>72 101 108 108 111</xxx>
      <yyy>Hello</yyy>
      <zzz>
            <item  char="5"
                        code="53"/>
            <item  char=":"
                        code="58"/>
            <item  char="?"
                        code="63"/>
            <item  char="D"
                        code="68"/>
            <item  char="I"
                        code="73"/>
            <item  char="N"
                        code="78"/>
            <item  char="S"
                        code="83"/>
            <item  char="X"
                        code="88"/>
            <item  char="]"
                        code="93"/>
            <item  char="b"
                        code="98"/>
      </zzz>


Previous chapter: Arithmetics
Next chapter: Transforming strings with regular expressions
Previous page: Escaping of URI with encode-for-uri, iri-to-uri, and escape-html-uri
Next page: - - -

Kevin Carr in Stanton

Natural Skin Care and European Soaps
TickTalk 5
city of stanton
internetusers


You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks