Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Transforming strings with regular expressions (8/8) >

Creation of text nodes from a string with a regular expression separator

If element xsl:non-matching-substring is used instead of xsl:matching-substring inside xsl:analyze-string, the regular expression in regex specifies a separator which splits the input string into several parts. From each of these parts a text node is created, the separators are discarded.

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">
                  <xsl:analyze-string  select="bbb"
                              regex="\s">
                        <xsl:non-matching-substring>
                              <aaa>
                                    <xsl:value-of  select="."/>
                              </aaa>
                        </xsl:non-matching-substring>
                  </xsl:analyze-string>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>
            <bbb>How do you do?</bbb>
      </aaa>
Output

      <aaa>How</aaa>
      <aaa>do</aaa>
      <aaa>you</aaa>
      <aaa>do?</aaa>


Previous chapter: Functions operating on strings
Next chapter: Number Formatting
Previous page: Creation of text nodes from a string with regular expressions - function analyze-string
Next page: - - -

Kevin Carr in Stanton

Natural Skin Care and European Soaps
Kevin Carr
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