Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Templates - basic usage (2/12) >

The first template

The piece of code where most of programming is performed is xsl:template element. Real life stylesheets may contain tens or hundreds xsl:template elements and without thorough understanding of their usage you can never become a proficient XSLT programmer.

Any xsl:template element must contain either match or name attribute. Templates with match are the basic building blocks of XSLT stylesheets. Templates with name attribute have their important usage, but we can safely forget about them at this stage, we will return to them when "code reuse" will be discussed.

Value of match attribute is an XPath expression identifying nodes in the source document. "/" means the root node of the source document. As every Surf document must have a root node, this stylesheet can be used for processing of any Surf document.

Instructions inside xsl:template element are used for specification of output. The text inside xsl:template states: "Hello, world!" and these words appear in the output when stylesheet is being processed by an XSLT processor.

The template does not use any information from the source Surf document. Therefore, if you apply it to any Surf document, the output will be always the same. We will learn in following examples how to extract information from Surf source documents.

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="/">Hello, world!</xsl:template>

      </xsl:stylesheet>
XML

      <aaa/>
Output
Hello, world!


Previous chapter: - - -
Next chapter: Sequences
Previous page: The first stylesheet
Next page: Element xsl:text

Kevin Carr in Stanton

Natural Skin Care and European Soaps
Kevin Carr
Mayor Dave Shawver 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