The <xsl:stylesheet>
element (or the equivalent <xsl:transform>
element) is the outermost element of a stylesheet.
Namespace Declaration
A pseudo-attribute required to identify the document as an XSLT stylesheet. Typically this is xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
.
Syntax
<xsl:stylesheet version="NUMBER" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" id="NAME" extension-element-prefixes="LIST-OF-NAMES" exclude-result-prefixes="LIST-OF-NAMES"> ENTIRE STYLESHEET </xsl:stylesheet>
Required Attributes
version
- Specifies the version of XSLT required by this stylesheet.
Optional Attributes
exclude-result-prefixes
- Specifies any namespace used in this document that should not be sent to the output document. The list is whitespace separated.
extension-element-prefixes
- Specifies a space-separated list of any namespace prefixes for extension elements in this document.
default-collation
- Specifies the default collation used by all XPath expressions appearing in attributes or text value templates that have the element as an ancestor, unless overridden by another
default-collation
attribute on an inner element. It also determines the collation used by certain XSLT constructs (such as<xsl:key>
andxsl:for-each-group
) within its scope. default-mode
- Defines the default value for the
mode
attribute of all<xsl:template>
and<xsl:apply-templates>
elements within its scope. default-validation
- Defines the default value of the
validation
attribute of all relevant instructions appearing within its scope. expand-text
- Determines whether descendant text nodes of the element are treated as text value templates.
id
- Specifies an
id
for this stylesheet. This is most often used when the stylesheet is embedded in another XML document. input-type-annotations
- Specifies whether type annotations are stripped from the element so the same results are produced whether the source documents have been validated against a schema or not.
use-when
- Determines whether the element and all the nodes that have it as ancestor are excluded from the stylesheet.
xpath-default-namespace
- Specifies the namespace that will be used if the element name is unprefixed or an unprefixed type name within an XPath expression.
Type
Required outermost element of stylesheet.
Specifications
Specification | Status | Comment |
---|---|---|
XSLT 3.0 The definition of '<xsl:stylesheet>' in that specification. |
Recommendation | Added the attributes default-mode , expand-text , and use-when . |
XSLT 2.0 | Added the attributes xpath-default-namespace , default-validation , default-collation , and input-type-annotations and made all attributes except version optional. |
|
XSLT 1.0 | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
stylesheet | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1.5 | IE Full support Yes | Opera Full support Yes | Safari Full support 3 | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support 3 | Samsung Internet Android Full support 1.0 |
exclude-result-prefixes | Chrome ? | Edge ? | Firefox Full support Yes | IE ? | Opera ? | Safari ? | WebView Android ? | Chrome Android ? | Firefox Android Full support Yes | Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
extension-element-prefixes | Chrome ? | Edge ? | Firefox No support No | IE ? | Opera ? | Safari ? | WebView Android ? | Chrome Android ? | Firefox Android No support No | Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
id | Chrome ? | Edge ? | Firefox
Partial support
7
| IE ? | Opera ? | Safari ? | WebView Android ? | Chrome Android ? | Firefox Android
Partial support
7
| Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
version | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1.5 | IE Full support Yes | Opera Full support Yes | Safari Full support 3 | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support 3 | Samsung Internet Android Full support 1.0 |
Legend
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- See implementation notes.
- See implementation notes.