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

Joining strings with string-join()

The function string-join() joins a sequence of strings provided by the first argument using the second argument as a separator. If the first argument is not a sequence of strings a fatal error is issued. In the example zzz integers are cast to string with "cast as".

XSLT

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

            <xsl:template  match="/aaa">
                  <xxx>
                        <xsl:value-of  select="string-join(*,' : ')"/>
                  </xxx>
                  <yyy>
                        <xsl:value-of  select="string-join((*,'|||',*),'')"/>
                  </yyy>
                  <zzz>
                        <xsl:value-of  select="string-join(for $a in (1 to 10) return $a cast as sch:string,'-')"/>
                  </zzz>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>
            <bbb>How</bbb>
            <ccc>do</ccc>
            <ddd>you</ddd>
            <eee>do</eee>
      </aaa>
Output

      <xxx>How : do : you : do</xxx>
      <yyy>Howdoyoudo|||Howdoyoudo</yyy>
      <zzz>1-2-3-4-5-6-7-8-9-10</zzz>


Previous chapter: Arithmetics
Next chapter: Transforming strings with regular expressions
Previous page: Joining strings with concat
Next page: Absolute URIs' from relative ones with resolve-uri function

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