Implicit templates for text nodes converts their contents to a string and sends them to output.
|
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:apply-templates select="bbb/text()"/> </xxx> <yyy> <xsl:apply-templates select="ccc/text()"/> </yyy> </xsl:template> <xsl:template match="bbb/text()"> <BBB> <xsl:value-of select="string(.)"/> </BBB> </xsl:template> </xsl:stylesheet> |
|
|
XML
<aaa> <bbb>BBB</bbb> <ccc>CCC</ccc> </aaa> |
Output
<xxx> <BBB>BBB</BBB> </xxx> <yyy>CCC</yyy> |
| Previous chapter: | Context |
| Next chapter: | Arithmetics |
| Previous page: | Implicit template for attributes |
| Next page: | Implicit passing of parameters |