XSLT 1.0 reference (elements and attributes)
XSLT elements
xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:attribute-set | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:decimal-format | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:import | xsl:include | xsl:key | xsl:message | xsl:namespace-alias | xsl:number | xsl:otherwise | xsl:output | xsl:param | xsl:preserve-space | xsl:processing-instruction | xsl:sort | xsl:strip-space | xsl:stylesheet | xsl:template | xsl:text | xsl:transform | xsl:value-of | xsl:variable | xsl:when | xsl:with-param|
XSLT attributes
case-order | cdata-section-elements | count | data-type | decimal-separator | digit | disable-output-escaping | doctype-public | doctype-system | elements | encoding | exclude-result-prefixes | extension-element-prefixes | format | from | grouping-separator | grouping-size | href | id | indent | infinity | lang | letter-value | level | match | media-type | method | minus-sign | mode | name | namespace | NaN | omit-xml-declaration | order | pattern-separator | per-mille | percent | priority | result-prefix | select | standalone | stylesheet-prefix | terminate | test | use | use-attribute-sets | value | version | xml:space | xmlns:xsl | zero-digit |
XSLT elements
The xsl:apply-imports element is used to search for appropriate templates for the context nodes. For this purpose, only context nodes are taken into account which were imported with xsl:import. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param
|
Child elements |
Attributes |
With the help of this element, a node volume is selected. The nodes are processed by the appropriate templates. With the select attribute only the selected child elements are processed, otherwise all child elements are included. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param |
Child elements |
For generating attributes in the target document. The name of the characteristic to be generated is indicated with the name attribute. The value of the attribute is the content of xsl:attribute. |
Parent elements xsl:attribute-set | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements xsl:apply-imports | xsl:apply-templates | xsl:call-template | xsl:choose | xsl:copy | xsl:copy-of | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:text | xsl:value-of | xsl:variable |
Container element to include defaults of several attributes (xsl:attribute). With the name attribute the setting gets an unique identifier which can be referenced by the xsl:use-attribute-sets attribute. |
Parent elements |
Child elements |
Attributes |
For calling up a named template. With the name attribute a xsl:template element is called up, whose name attribute corresponds to the specified value. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:output | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements |
Attributes |
Element for choosing from several alternatives. Two different child elements of xsl:choose are used. With xsl:when conditions can be set up for the alternatives. When the condition of a xsl:when element is met, the relevant section is pasted into the target document. When none of the conditions being set up with xsl:when is met, xsl:otherwise is used. With xsl:otherwise a preset value is used which is pasted into the target document. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements |
Attributes |
For inserting comments into the target document. |
Parent elements xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements xsl:apply-imports | xsl:apply-templates | xsl:call-template | xsl:choose | xsl:copy | xsl:copy-of | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:otherwise | xsl:text | xsl:value-of | xsl:variable |
Attributes |
For copying context nodes into the target document. Only a flat copy is generated, which means any attributes and child elements will be ignored. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:processing-instruction | xsl:text | xsl:value-of | xsl:variable |
Attributes |
For copying a context node into the target document. A deep copy is generated, which means any attributes and child elements are included. With the obligatory select attribute the node or the node volume of which the copy is to be generated has to be indicated. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements |
Attributes |
For the determination of the format in which decimal numbers are displayed. |
Parent elements |
Child elements |
Attributes |
For generating XML elements in the target document. The name of the element is defined with the name attribute. The content of the generated element corresponds to the content of xsl:element. |
Parent elements xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:processing-instruction | xsl:text | xsl:value-of | xsl:variable |
Attributes |
For the determination of a code passage, which is used in case an expected external XSLT extension cannot be executed. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:output | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:processing-instruction | | xsl:variable |
Attributes |
For generating a loop which runs at each chosen context node. The required select attribute names the context node to be chosen. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:output | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:processing-instruction | xsl:sort | xsl:text | xsl:value-of | xsl:variable |
Element for the limited flow control. A Boolean value has to be indicated for the test attribute in order to be queried. If the condition applies (is true), the condition set up by xsl:if is displayed. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:output | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:processing-instruction | xsl:text | xsl:value-of | xsl:variable |
For including external XSL stylesheets in the target document. The external stylesheet replaces the xsl:import element which has been set at this position in the target document. The xsl:import element is a top-level element, which means it can only be used at the top level of the stylesheet. For the href attribute a valid path (URL) has to be indicated for the stylesheet to be included. The difference to xsl:include lies in the lower priority which is given to the templates being included with xsl:import. |
Parent elements |
Child elements |
Attributes |
For including external XSL stylesheets in the target document. The external stylesheet replaces the xsl:include element being set at this position in the target document. The xsl:include element is a top-level element, which means it can only be used at the top level of the stylesheets. For the href attribute a valid path (URL) has to be indicated for the stylesheet to be included. The difference to xsl:import lies in the higher priority which is given to the templates being included with xsl:include. |
Parent elements |
Child elements |
Attributes |
xsl:key |
For defining a key in order to search for nodes. |
Parent elements |
Child elements |
For outputting a message during the processing in the XSLT processor. When the optional terminate attribute is set to the value yes, processing is interrupted at the respective position. The process continues with the preset value no. With the help of this element, you can see what happens during the processing of the stylesheet. The messages allow to find the sections in the stylesheet which are defective. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:processing-instruction | xsl:text | xsl:value-of | xsl:variable |
For replacing a namespace in the stylesheet with another namespace in the output. |
|
Parent elements |
Child elements |
Attributes |
The position of an element in the target document is outputted by the element as a number. It is used for numbering. With the count attribute the element to be counted is defined. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements |
Attributes |
With this element a value can be preset in xsl:choose which is pasted into the target document if none of the conditions being set up in xsl:when applies. |
Parent elements |
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:processing-instruction | xsl:text | xsl:value-of | xsl:variable |
Attributes |
For setting up (meta) defaults for the target document to be generated. |
Parent elements |
Child elements |
Attributes |
With this element parameters are defined. If the xsl:param element is a top-level element, it is a matter of global parameters and it applies for the entire stylesheet, otherwise the parameters are only locally valid. With the name attribute the name of the parameter is defined. The value of the parameter can be defined by indicating the select attribute or by the content of the element. |
Parent elements |
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:processing-instruction | xsl:text | xsl:value-of | xsl:variable |
With this element it is possible to indicate for which elements white spaces shall be preserved. In principle, xsl:preserve-space is a default in XSLT and valid for all elements. If, however, whitespaces are removed with xsl:strip-space, the elements can be firmly indicated for which the whitespaces are preserved, with the help of xsl:preserve-space and the required elements attribute. |
Parent elements |
Child elements |
Attributes |
For generating process related instructions in the output document. With the obligatory name attribute, the name of the processing instruction is indicated. |
Parent elements xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements xsl:apply-imports | xsl:apply-templates | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:text | xsl:value-of | xsl:variable |
With this element nodes can be sorted as a child element of xsl:apply-templates or xsl:for-each. |
Parent elements |
Child elements |
Attributes |
For removing whitespace in the source document. With the required elements attribute, the elements are indicated from which the whitespace shall be removed. Text nodes which only contain whitespace are removed. |
Parent elements |
Child elements |
Attributes |
Root element for a XSLT stylesheet. Optionally, also xsl:transform can be used as a root element. |
Parent elements |
Child elements
|
Attributes |
With the element, processing rules are set up for a node. With the match attribute, the node is determined for which the processing rule shall apply. With the optional name attribute, a name can be assigned to a template, which can be called up by xsl:call-template. |
Parent elements |
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:param | xsl:processing-instruction | xsl:text | xsl:value-of | xsl:variable |
With this element literal text can be inserted unchanged into the target document. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements |
Attributes |
Root element for a XSLT stylesheet. Optionally, also xsl:stylesheet can be used as a root element. |
Parent elements |
Child elements xsl:attribute-set | xsl:decimal-format | xsl:import | xsl:include | xsl:key | xsl:namespace-alias | xsl:output | xsl:param | xsl:preserve-space | xsl:strip-space | xsl:template | xsl:variable |
Attributes |
With this element the value of an element of the target document is passed on for further processing. With the required select attribute, the node to be accessed is indicated. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:processing-instruction | xsl:template | xsl:variable | xsl:when | xsl:with-param|
|
Child elements |
Attributes |
For setting up and declaring variables. When it is used as a top-level element, the variable being set up becomes global and is valid for the entire stylesheet. Apart from that, it only becomes locally valid. With the required name attribute, the name of the variable is defined. The value of the variable is determined either by the select attribute or by the content of the element. |
Parent elements xsl:attribute | xsl:comment | xsl:copy | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:otherwise | xsl:param | xsl:processing-instruction | xsl:stylesheet | xsl:template | xsl:transform | xsl:variable | xsl:when | xsl:with-param|
|
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:processing-instruction | xsl:text | xsl:value-of | xsl:variable |
For setting up a condition in xsl:choose in order to choose from various alternatives. A Boolean value has to be indicated for the test attribute in order to be queried. If the condition applies (is true), the relevant section is pasted into the target document. |
Parent elements |
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:processing-instruction | xsl:text | xsl:value-of | xsl:variable |
Passes on a parameter to a named template. If values for the select attribute are indicated in xsl:param, they are used as standard values in the document. With the obligatory name attribute of xsl:with-param, the name of the parameter can be given. With the help of the optional select attribute, it is possible to indicate other values for a parameter. |
Parent elements |
Child elements xsl:apply-imports | xsl:apply-templates | xsl:attribute | xsl:call-template | xsl:choose | xsl:comment | xsl:copy | xsl:copy-of | xsl:element | xsl:fallback | xsl:for-each | xsl:if | xsl:message | xsl:number | xsl:processing-instruction | xsl:text | xsl:value-of | xsl:variable |
XSLT attributes
Determines whether the sorting in xsl:sort is done at first by lower case letters (lower-first) or by upper case letters (upper-first). |
Values |
Default |
Elements |
Determines elements in xsl:output. Their contents shall be inserted into the output file as a CDATA section. |
Values |
Default |
Elements |
Determines in xsl:number the nodes to be counted. A matching search pattern (XPath expression) has to be indicated. |
Value |
Default |
Elements |
Determines whether the sorting in xsl:sort is done numerically (number) or alphabetically (text). |
Values |
Default |
Elements |
Determines the separator in xsl:decimal-format, which shall be put between the integer part and the decimal part of a value. |
Values |
Default |
Elements |
Determines a character in xsl:decimal-format, which shall serve as a wildcard character for digits in format strings. |
Values |
Default |
Elements |
When set up in xsl:text or xsl:value-of, the transformation of special characters (e.g. <, &, >) is made possible or is refused. |
Values |
Default |
Elements |
Generates in xsl:output the public identifier which shall be used in the <!DOCTYPE> declaration. |
Values |
Default |
Elements |
Generates in xsl:output the system-immanent identifier which shall be used in the <!DOCTYPE> declaration. |
Values |
Default |
Elements |
In xsl:preserve-space or xsl:strip-space elements are indicated in which the whitespace shall be preserved or not. The respective elements have to be presented separated by a space character. |
Values |
Default |
Elements |
Determines in xsl:output which standard shall be used for the character encoding (e.g. utf-8). |
Values |
Default |
Elements |
Determines in xsl:stylesheet or xsl:transform which namespaces shall not be copied into the output document. |
Values |
Default |
Elements |
Determines in xsl:stylesheet or xsl:transform the extensions needed for using extended elements in the stylesheet. |
Values |
Default |
Elements |
Determines in xsl:number the output format for the "number" (e.g. 1, a or i). |
Values |
Default |
Elements |
Determines in xsl:number the position from which a counting shall begin. A matching pattern (XPath expression) has to be indicated. |
Values |
Default |
Elements |
For the determination of a character in xsl:number or in xsl:decimal-format which separates groups of numbers. |
Values |
Default |
Elements |
Determines in xsl:number the number of digits which shall belong to a group. |
Values |
Default |
Elements |
For the determination of the path in xsl:import or xsl:include for the external stylesheet to be included. |
Values |
Default |
Elements |
Determines in xsl:stylesheet or xsl:transform an identifier for the stylesheet. |
Values |
Default |
Elements |
Determines in xsl:output whether the output shall be displayed indented, in order to show the hierachical structure, or not. |
Values |
Default |
Elements |
Determines in xsl:decimal-format a character string which shall represent the value "infinite". |
Values |
Default |
Elements |
For the determination of the language whose conventions for sorting (xsl:sort) or numbering (xsl:number) shall be used. The value to be indicated is a two-letter language code according to ISO 639-1:2000 (e.g. en for English, de for German). |
Values |
Default |
Elements |
For distinguishing different numbering schemes in xsl:number. |
Values |
Default |
Elements |
Determines in xsl:number how the generated sequence numbers shall be assigned. Possible values are: single, sibling nodes are numbered on the same level; any, all named nodes are numbered regardless of their position in the document and multiple, for generating multi-level numberings. |
Values |
Default |
Elements |
For the determination of a search pattern (XPath expression) for xsl:key or xsl:template according to which the nodes to be processed are located. |
Values |
Default |
Elements |
Determines in xsl:output the media type (MIME-Type) of the output. |
Values |
Default |
Elements |
Determines in xsl:output the output format (e.g. xml, html, text). |
Values |
Default |
Elements |
Determines in xsl:decimal-format a character which shall represent the minus sign. |
Values |
Default |
Elements |
Determines in xsl:template a processing mode for a template. When the relevant attribute value is called up by xsl:apply-templates, only the corresponding part of the template is addressed. |
Values |
Default |
Elements |
For indicating a name for a selected element. |
Values |
Default |
Elements |
Generates a namespace for a new xsl:attribute or a new xsl:element. |
Values |
Default |
Elements |
Determines in xsl:decimal-format a character string which shall represent the value "Not a Number". |
Values |
Default |
Elements |
Determines in xsl:output whether the XML declaration shall be included in the output. |
Values |
Default |
Elements |
Determines whether the order of the sorting in xsl:sort shall be ascending or descending. |
Values |
Default |
Elements |
Determines in xsl:decimal-format a character which separates positive numbers from negative numbers when diplaying the number format. |
Values |
Default |
Elements |
Determines in xsl:decimal-format the character which shall represent the per mille sign. |
Values |
Default |
Elements |
Determines in xsl:decimal-format the character which shall represent the percent sign. |
Values |
Default |
Elements |
Determines the priority for a xsl:template element. If several templates encounter the same nodes, it can be determined which template has priority. |
Values |
Default |
Elements |
Determines in xsl:namespace-alias the prefix which shall be adopted for the respective namespace in the result document. |
Values |
Default |
Elements |
For defining a search and selection criterion. For this purpose, the matching search pattern (XPath expression) has to be indicated. |
Values |
Default |
Elements |
Determines in xsl:output whether a file gets by without external DTD or not. |
Values |
Default |
Elements |
Indicates in xsl:namespace-alias the namespace prefix which is used in the stylesheet. |
Values |
Default |
Elements |
For indicating whether the processing shall be terminated after the output of the message of xsl:message. |
Values |
Default |
Elements |
For indicating the condition which shall be tested with xsl:if or xsl:when. |
Values |
Default |
Determines in xsl:key the value for the key. |
Values |
Default |
Elements |
For referencing the attribute sets being set up in xsl:attribute-set. |
Values |
Default |
Elements |
Determines in xsl:number a number which shall be formatted. |
Values |
Default |
Elements |
Determines in xsl:stylesheet or xsl:transform the obligatory XSLT version. At the moment version 1.0 is commonly used. |
Values |
Default |
Elements |
Determines the handling of spaces from the XML source document. |
Values |
Default |
Elements |
Determines in the root element, that the namespace xsl shall be used for each XSL element in the stylesheet in order to avoid conflicts with other elements. |
Values |
Default |
Elements |
Determines in xsl:decimal-format a character, which shall indicate in format character strings where attached or preceding zeros are to be found. |
Values |
Default |
Elements |
<< back | next >> |