Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 46158 of Elements

  • Revision slug: XSLT/Elements
  • Revision title: Elements
  • Revision id: 46158
  • Created:
  • Creator: Bogdan
  • Is current revision? No
  • Comment 8 words added

Revision Content

{{ XsltRef() }} There are two types of elements discussed here: top-level elements and instructions. A top-level element must appear as the child of either <xsl:stylesheet> or <xsl:transform>. An instruction, on the other hand, is associated with a template. A stylesheet may include several templates. A third type of element, not discussed here, is the literal result element (LRE). An LRE also appears in a template. It consists of any non-instruction element that should be copied as-is to the result document, for example, an <hr> element in an HTML conversion stylesheet.

On a related note, any attribute in an LRE and some attributes of a limited number of XSLT elements can also include what is known as an attribute value template. An attribute value template is simply a string that includes an embedded XPath expression which is used to specify the value of an attribute. At run-time the expression is evaluated and the result of the evaluation is substituted for the XPath expression. For example, assume that a variable "image-dir" is defined as follows:

<xsl:variable name="image-dir">/images</xsl:variable>

The expression to be evaluated is placed inside curly brackets:

<img src="{$image-dir}/mygraphic.jpg"/>

This would result in the following:

<img src="/images/mygraphic.jpg"/>

The element annotations that follow include a description, a syntax listing, a list of required and optional attributes, a description of type and position, its source in the W3C Recommendation and an explanation of the degree of present Gecko support.

{{ languages( { "fr": "fr/XSLT/\u00c9l\u00e9ments", "ja": "ja/XSLT/Elements", "pl": "pl/XSLT/Elementy" } ) }}

Revision Source

<p>{{ XsltRef() }} There are two types of elements discussed here: top-level elements and instructions. A top-level element must appear as the child of either <code>&lt;xsl:stylesheet&gt;</code> or <code>&lt;xsl:transform&gt;</code>. An instruction, on the other hand, is associated with a template. A stylesheet may include several templates. A third type of element, not discussed here, is the literal result element (LRE). An LRE also appears in a template. It consists of any non-instruction element that should be copied as-is to the result document, for example, an <code>&lt;hr&gt;</code> element in an HTML conversion stylesheet.</p>
<p>On a related note, any attribute in an LRE and some attributes of a limited number of XSLT elements can also include what is known as an attribute value template. An attribute value template is simply a string that includes an embedded XPath expression which is used to specify the value of an attribute. At run-time the expression is evaluated and the result of the evaluation is substituted for the XPath expression. For example, assume that a variable "<code>image-dir</code>" is defined as follows:</p>
<pre>&lt;xsl:variable name="image-dir"&gt;/images&lt;/xsl:variable&gt;</pre>
<p>The expression to be evaluated is placed inside curly brackets:</p>
<pre>&lt;img src="{$image-dir}/mygraphic.jpg"/&gt;</pre>
<p>This would result in the following:</p>
<pre>&lt;img src="/images/mygraphic.jpg"/&gt;</pre>
<p>The element annotations that follow include a description, a syntax listing, a list of required and optional attributes, a description of type and position, its source in the W3C Recommendation and an explanation of the degree of present Gecko support.</p>
<ul> <li>{{ XSLTElement("apply-imports") }} <a href="/en/XSLT/apply-imports" title="en/XSLT/apply-imports">xsl:apply-imports</a></li> <li><a href="/en/XSLT/apply-templates" title="en/XSLT/apply-templates">xsl:apply-templates</a></li> <li><a href="/en/XSLT/attribute" title="en/XSLT/attribute">xsl:attribute</a></li> <li><a href="/en/XSLT/attribute-set" title="en/XSLT/attribute-set">xsl:attribute-set</a></li> <li><a href="/en/XSLT/call-template" title="en/XSLT/call-template">xsl:call-template</a></li> <li><a href="/en/XSLT/choose" title="en/XSLT/choose">xsl:choose</a></li> <li><a href="/en/XSLT/comment" title="en/XSLT/comment">xsl:comment</a></li> <li><a href="/en/XSLT/copy" title="en/XSLT/copy">xsl:copy</a></li> <li><a href="/en/XSLT/copy-of" title="en/XSLT/copy-of">xsl:copy-of</a></li> <li><a href="/en/XSLT/decimal-format" title="en/XSLT/decimal-format">xsl:decimal-format</a></li> <li><a href="/en/XSLT/element" title="en/XSLT/element">xsl:element</a></li> <li><a href="/en/XSLT/fallback" title="en/XSLT/fallback">xsl:fallback</a> <em>(not supported)</em></li> <li><a href="/en/XSLT/for-each" title="en/XSLT/for-each">xsl:for-each</a></li> <li><a href="/en/XSLT/if" title="en/XSLT/if">xsl:if</a></li> <li><a href="/en/XSLT/import" title="en/XSLT/import">xsl:import</a> <em>(mostly supported)</em></li> <li><a href="/en/XSLT/include" title="en/XSLT/include">xsl:include</a></li> <li><a href="/en/XSLT/key" title="en/XSLT/key">xsl:key</a></li> <li><a href="/en/XSLT/message" title="en/XSLT/message">xsl:message</a></li> <li><a href="/en/XSLT/namespace-alias" title="en/XSLT/namespace-alias">xsl:namespace-alias</a> <em>(not supported)</em></li> <li><a href="/en/XSLT/number" title="en/XSLT/number">xsl:number</a> <em>(partially supported)</em></li> <li><a href="/en/XSLT/otherwise" title="en/XSLT/otherwise">xsl:otherwise</a></li> <li><a href="/en/XSLT/output" title="en/XSLT/output">xsl:output</a> <em>(partially supported)</em></li> <li><a href="/en/XSLT/param" title="en/XSLT/param">xsl:param</a></li> <li><a href="/en/XSLT/preserve-space" title="en/XSLT/preserve-space">xsl:preserve-space</a></li> <li><a href="/en/XSLT/processing-instruction" title="en/XSLT/processing-instruction">xsl:processing-instruction</a></li> <li><a href="/en/XSLT/sort" title="en/XSLT/sort">xsl:sort</a></li> <li><a href="/en/XSLT/strip-space" title="en/XSLT/strip-space">xsl:strip-space</a></li> <li><a href="/en/XSLT/stylesheet" title="en/XSLT/stylesheet">xsl:stylesheet</a> <em>(partially supported)</em></li> <li><a href="/en/XSLT/template" title="en/XSLT/template">xsl:template</a></li> <li><a href="/en/XSLT/text" title="en/XSLT/text">xsl:text</a> <em>(partially supported)</em></li> <li><a href="/en/XSLT/transform" title="en/XSLT/transform">xsl:transform</a></li> <li><a href="/en/XSLT/value-of" title="en/XSLT/value-of">xsl:value-of</a> <em>(partially supported)</em></li> <li><a href="/en/XSLT/variable" title="en/XSLT/variable">xsl:variable</a></li> <li><a href="/en/XSLT/when" title="en/XSLT/when">xsl:when</a></li> <li><a href="/en/XSLT/with-param" title="en/XSLT/with-param">xsl:with-param</a></li>
</ul>
<p>{{ languages( { "fr": "fr/XSLT/\u00c9l\u00e9ments", "ja": "ja/XSLT/Elements", "pl": "pl/XSLT/Elementy" } ) }}</p>
Revert to this revision