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

Creation of text nodes from a string with regular expressions - function analyze-string()

The element xsl:analyze-stringCreates a sequence of text nodes from an input string. The parts of text to be selected are given by a regular expression in regex attribute.

The element xsl:matching-substring generates a text node from every string matched by the regex. Look at xsl:non-matching-substring for using regex as a separator.

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:matching-substring>
                              <aaa>
                                    <xsl:value-of  select="."/>
                              </aaa>
                        </xsl: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: Creating text nodes by regular expressions - function tokenize
Next page: Creation of text nodes from a string with a regular expression separator

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