"xsl:template xsl:value-of" : Introduction « XSLT stylesheet « XML Tutorial






An XSL processors parses an XML source and tries to find a matching template rule. 
If it does, instructions inside matching template are evaluated.

File: Data.xml

<data>
    <bold>Hello, world.</bold>
    <red>I am </red>
    <italic>fine.</italic>
</data>

File: Transform.xslt

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="bold">
      <paragraph>
        <b>
          <xsl:value-of select="."/>
        </b>
      </paragraph>
    </xsl:template>
    <xsl:template match="red">
      <paragraph style="color:red">
        <xsl:value-of select="."/>
      </paragraph>
    </xsl:template>
    <xsl:template match="italic">
      <paragraph>
        <i>
          <xsl:value-of select="."/>
        </i>
      </paragraph>
    </xsl:template>

</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="UTF-8"?>
    <paragraph><b>Hello, world.</b></paragraph>
    <paragraph style="color:red">I am </paragraph>
    <paragraph><i>fine.</i></paragraph>








5.1.Introduction
5.1.1.With XSL you can modify any source text and produce different output from the same source file
5.1.2.Every XSL stylesheet must start with xsl:stylesheet element
5.1.3."xsl:template xsl:value-of"
5.1.4."xsl:value-of xsl:apply-templates"
5.1.5.Insert html tags into template
5.1.6.Batch-Processing Nodes