<html>
<head>
<title>&lt;xsl:stylesheet&gt;</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="Description">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">&lt;xsl:stylesheet&gt;</td>
<td valign="top" class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">
The root element of an XSLT stylesheet. It is identical to the <span class="LITERAL">&lt;xsl:transform&gt;</span> element, which was included in the XSLT specification for historical purposes. </td></tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Category</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>Contains the entire stylesheet</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Required Attributes</td>
</tr>
<tr>
<td colspan="2" class="description">
<dl>
<dt>
version
</dt>
<dd>
Indicates the version of XSLT that the stylesheet requires. For XSLT version 1.0, its value should always be
<span class="LITERAL">
"
1.0
"
</span>
. As later versions of the XSLT specification are defined, the required values for the
<span class="LITERAL">
version
</span>
attribute will be defined along with them.
<P></p>
<dt>
xmlns:xsl
</dt>
<dd>
Defines the URI for the XSL namespace. For XSLT Version 1.0, this attribute's value should be
<span class="LITERAL">
http://www.w3.org/1999/XSL/Transform
</span>
. Note that most XSLT processors will give you a warning message if your
<span class="LITERAL">
xmlns:xsl
</span>
declaration does not have the proper value.
<P></p>
</dl>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Optional Attributes</td>
</tr>
<tr>
<td colspan="2" class="description">
<dl>
<dt>
id
</dt>
<dd>
Defines an ID for this stylesheet.
<P></p>
<dt>
extension-element-prefixes
</dt>
<li>
<!--<?troff .hw name-space?>-->
<p>
Defines any namespace prefixes used to invoke extension elements. Multiple namespace prefixes are separated by whitespace.
</p>
</li>
<dt>
exclude-result-prefixes
</dt>
<dd>
Defines namespace prefixes that should not be sent to the output document. Multiple namespace prefixes are separated by whitespace.
<P></p>
</dl>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Content</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>This element contains the entire stylesheet. The following items can be children of <span class="LITERAL">&lt;xsl:stylesheet&gt;</span>:</p>
<ul>
        <dd>
<span class="LITERAL">&lt;xsl:import&gt;</span>
</p>
        </li>
        <dd>
<span class="LITERAL">&lt;xsl:include&gt;</span>
</p>
        </li>
        <dd>
<span class="LITERAL">&lt;xsl:strip-space&gt;</span>
</p>
        </li>
        <dd>
<span class="LITERAL">&lt;xsl:preserve-space&gt;</span>
</p>
        </li>
        <dd>
<span class="LITERAL">&lt;xsl:output&gt;</span>
</p>
        </li>
        <dd>
<span class="LITERAL">&lt;xsl:key&gt;</span>
</p>
        </li>
        <dd>
<span class="LITERAL">&lt;xsl:decimal-format&gt;</span>
</p>
        </li>
        <dd>
<span class="LITERAL">&lt;xsl:namespace-alias&gt;</span>
</p>
        </li>
        <dd>
<span class="LITERAL">&lt;xsl:attribute-set&gt;</span>
</p>
        </li>
        <dd>
<span class="LITERAL">&lt;xsl:variable&gt;</span>
</p>
        </li>
        <dd>
<span class="LITERAL">&lt;xsl:param&gt;</span>
</p>
        </li>
        <dd>
<span class="LITERAL">&lt;xsl:template&gt;</span>
</p>
        </li>
      </ul>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Appears in</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>None. <span class="LITERAL">&lt;xsl:stylesheet&gt;</span> is the root element of the stylesheet.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Defined in</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>XSLT section 2.2, Stylesheet Element. </p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>For the sake of completeness, we'll include an example here. We'll use the Hello World document from the XML 1.0 specification for our example:</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version="1.0"?&gt;
&lt;greeting&gt;
  Hello, World!
&lt;/greeting&gt;</pre></span>
<p>We'll transform our document with this stylesheet:</p>
<span class="PROGRAMLISTING"><pre>
&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
  &lt;xsl:output method="html"/&gt;

  &lt;xsl:template match="/"&gt;
    &lt;xsl:apply-templates select="greeting"/&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="greeting"&gt;
    &lt;html&gt;
      &lt;body&gt;
        &lt;h1&gt;
          &lt;xsl:value-of select="."/&gt;
        &lt;/h1&gt;
      &lt;/body&gt;
    &lt;/html&gt;
  &lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;</pre></span>
<p>When we transform our document with this stylesheet, here are the results:</p>
<span class="PROGRAMLISTING"><pre>
&lt;html&gt;
&lt;body&gt;
&lt;h1&gt;
  Hello, World!
&lt;/h1&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></span>
</td>
</tr>
</table>
</div>
</body>
</html>