The document element of a style sheet, containing all other stylesheet elements.
<xsl:stylesheet id = "id" extension-element-prefixes = "prefixes" exclude-result-prefixes = "prefixes" version = "number"> </xsl:stylesheet>
| Number of occurrences | One |
| Parent elements | (No parent elements) |
| Child elements | xsl:include, xsl:output, xsl:param, xsl:template, xsl:variable,msxsl:script |
A style sheet contains the <xsl:stylesheet> element. This element can have a set of <xsl:template> elements representing different output templates. Processing begins by processing the root template, indicated by the pattern "/".
This example shows a complete XSLT style sheet that contains a set of templates. The root template (match="/") defines the structure of the overall output document, and the other templates define the structure of the name, address, and phone elements.
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<HTML>
<BODY>
<TABLE>
<xsl:for-each select="customers/customer">
<TR>
<xsl:apply-templates select="name" />
<xsl:apply-templates select="address" />
<xsl:apply-templates select="phone" />
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="name">
<TD STYLE="font-size:14pt font-family:serif">
<xsl:apply-templates />
</TD>
</xsl:template>
<xsl:template match="address">
<TD> <xsl:apply-templates /> </TD>
</xsl:template>
<xsl:template match="phone">
<TD> <xsl:apply-templates /> </TD>
</xsl:template>
<xsl:template match="text()"><xsl:value-of /></xsl:template>
</xsl:stylesheet>