XSLT <xsl:stylesheet> and <xsl:transform> elements

Definition and Usage

The <xsl:stylesheet> and <xsl:transform> elements are completely synonymous elements. They are both used to define the root element of the stylesheet.

Syntax

<xsl:stylesheet
id="name"
version="version"
extension-element-prefixes="list"
exclude-result-prefixes="list">
  <!-- Content:(<xsl:import>*,top-level-elements) -->
</xsl:stylesheet>
<xsl:transform
id="name"
version="version"
extension-element-prefixes="list"
exclude-result-prefixes="list">
  <!-- Content:(<xsl:import>*,top-level-elements) -->
</xsl:transform>

Attribute

Attribute Value Description
version version Required. Specifies the XSLT version of the stylesheet.
extension-element-prefixes list

Optional. The list of namespace prefixes for extended elements, separated by spaces.

Netscape 6 does not support this attribute.

exclude-result-prefixes list Optional. The list of namespace prefixes that should not appear in the output, separated by spaces.
id name

Optional. The unique id of the stylesheet.

Netscape 6 does not support this attribute.

Instance

Example 1

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

Example 2

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
....
....
</xsl:transform>