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

Home
XML Tutorial
1.Introduction
2.Namespace
3.XML Schema
4.XPath
5.XSLT stylesheet
XML Tutorial » XSLT stylesheet » Introduction 
5.1.4."xsl:value-of xsl:apply-templates"
File: Data.xml

<employee>
  <firstName>Joe</firstName>
  <surname>Smith</surname>
</employee>



File: Transform.xslt

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

    <xsl:template match="employee">
      <b>
        <xsl:value-of select="."/>
      </b>
    </xsl:template>
    <xsl:template match="surname">
      <i>
        <xsl:value-of select="."/>
      </i>
    </xsl:template>

</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="UTF-8"?><b>
  Joe
  Smith
</b>
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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.