Previous | Next | Indexes
Zvon > Tutorials > XSLT 2.0 Tutorial > Recursions (6/6) >

Recursive processing of text nodes

In this example text nodes are further processed - they are transformed to upper case with help of upper-case() function.

The text nodes are matched with "text()" test.

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="*">
                  <xsl:copy>
                        <xsl:copy-of  select="@*"/>
                        <xsl:apply-templates/>
                  </xsl:copy>
            </xsl:template>

            <xsl:template  match="text()">
                  <xsl:value-of  select="upper-case(.)"/>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa  a="aaa">
            <bbb>Hello!</bbb>
            <ccc  u="1"
                        v="2">
                  <ddd>How</ddd>
                  <eee  r="3">do you do?</eee>
            </ccc>
      </aaa>
Output

      <aaa  a="aaa">
            <bbb>HELLO!</bbb>
            <ccc  u="1"
                        v="2">
                  <ddd>HOW</ddd>
                  <eee  r="3">DO YOU DO?</eee>
            </ccc>
      </aaa>


Previous chapter: Keys
Next chapter: Date and Time
Previous page: Recursive change of the value of attributes
Next page: - - -