XSL elements Index

XSLT Functions

XSLT Functions XSLT includes over 100 built-in functions. There are functions for string values, numeric values, date and time comparison, node and QName manipulation, sequence manipulation, Boolean values, and more. Note: XQuery 1.0, XPath 2.0, and XSLT 2.0 share the same functions library. The following XSLT and XPath functions should return true if a processor supports the W3C XSLTstandard. boolean name ceiling namespace-uri concat …

XSLT Functions Read More »

xsl:stylesheet or xsl:transform

<xsl:stylesheet> or <xsl:transform> The <xsl:stylesheet> or <xsl:transform> elements identify a complete stylesheet. They are completely synonymous. <xsl:stylesheet id = id extension-element-prefixes = tokens exclude-result-prefixes = tokens version = number> <!– Content: (xsl:import*, top-level-elements) –> </xsl:stylesheet> id  A unique identifier extension-element-prefixes Identifies namespace (http://www.w3.org/TR/REC-xml-names) prefixes that are extension element prefixes exclude-result-prefixes  Lists namespace (http://www.w3.org/TR/REC-xml-names) prefixes that should not be …

xsl:stylesheet or xsl:transform Read More »

<xsl:template> <xsl:template match=”pattern” mode=”qname” name=”qname” priority=”number” > </xsl:template> The xsl:template element is used to define a template that can be applied to a node to produce a desired output display. There must be either a match or name attribute, or both, and this determines how the template rule can be invoked. If there is only a match …

Read More »

xsl:apply-templates

<xsl:apply-templates> <xsl:apply-templates select=”expression” mode=”qname” > </xsl:apply-templates> The xsl:apply-templates element defines a set of nodes to be processed, or by default selects all child nodes of the current node being processed, and finds a matching template rule to apply to each node in the set. Since each node in the node set is treated individually, it is possible …

xsl:apply-templates Read More »

xsl:for-each

<xsl:for-each> <xsl:for-each select=”expression” /> </xsl:for-each> The xsl:for-each element loops through each node in a node set in itsr order of occurrence and applies the same template to each node. A node set is simply the collection of all of the same XML tags (nodes) in an XML file. This process is also referred to as iterating over a set of nodes. …

xsl:for-each Read More »

xsl:call-template

<xsl:call-template> <xsl:call-template name=”qname” > </xsl:call-template> The xsl:call-template element is used to invoke a template by name. By invoke, we mean that the named template is called and applied to the source document. If a template does not have a name, it cannot be called by this element. The xsl:template element is used to create a template. You can name …

xsl:call-template Read More »

xsl:param

<xsl:param> <xsl:param name=”qname” > </xsl:param> Or: <xsl:param name=”qname” select=”expression” /> The xsl:param element is used to declare a local or global parameter and to give that parameter a name and a default value. The default value will be used only if no other value is provided when the template is called. The default value can be assigned by either the content of the xsl:param element or …

xsl:param Read More »

xsl:with-param

<xsl:with-param> <xsl:with-param name=”qname” > </xsl:param> Or: <xsl:with-param name=”qname” select=”expression” /> The xsl:with-param element is used to set the explicit value of a named parameter when using thexsl:apply-templates and the xsl:call-template elements. The concept is that the xsl:param element is used to declare a local or global parameter by assigning a name and a default value. The xsl:with-param element is used to set the …

xsl:with-param Read More »

xsl:text

<xsl:text> <xsl:text disable-output-escaping=”yes” | “no” > </xsl:text> The xsl:text element is used to add literal text to the output. This element cannot contain any other XSLelements. It can only contain text. Normally, any text that occurs in a stylesheet will be copied to the output regardless if it is enclosed by an xsl:text element. However, there are two primary reasons for …

xsl:text Read More »

xsl:copy

<xsl:copy> <xsl:copy use-attribute-sets=”name-list” > </xsl:copy> The xsl:copy element copies the current node in the source document to the output. The copy has the same name, namespace, and type as the original node, but any attributes, children, and other descendants are not copied. (Note that you can apply this element recursively to copy attributes and children.) The xsl:copy-of element can be used …

xsl:copy Read More »

xsl:copy-of

<xsl:copy-of> Syntax: <xsl:copy-of select=”expression” /> The xsl:copy-of element inserts a duplicate copy of a node set or tree fragment into the output. Perhaps the most important aspect of this element is that it allows you to insert multiple copies of the same set of nodes into different places in the output. For example, you may wish to …

xsl:copy-of Read More »

xsl:value-of

<xsl:value-of> <xsl:value-of select=”expression” disable-output-escaping=”yes” | “no” /> The xsl:value-of element is used to write or display in the result tree a string representation of the value assigned to a specified node. To explain it in another way, this XSLT element causes the value assigned to an XML tag to be displayed as text in the HTML page that we create to display the …

xsl:value-of Read More »

xsl:element

<xsl:element> Syntax: <xsl:element name=”element-name” namespace=”URI” use-attribute-sets=”qname” > </xsl:element> The xsl:element element is used to create and name an element (node) that can appear in the output. This ability to create both custom elements and attributes, and to display the results, is a major reason why stylesheets generated by XSL are a very sophisticated approach to displaying XML data. There are two ways to add …

xsl:element Read More »

xsl:if

<xsl:if> Syntax: <xsl:if test=”expression” > </xsl:if> The xsl:if element evaluates an expression which returns a Boolean result to determine if a template should be instantiated. The evaluation is a simple True or False test on a defined condition or a set of conditions. If the test returns True, the template is applied and the results are displayed in the output. If False, the template is …

xsl:if Read More »

xsl:choose

<xsl:choose> Syntax: <xsl:choose> <xsl:when test=”expression”> … </xsl:when> … <xsl:otherwise> … </xsl:otherwise> </xsl:choose> The xsl:choose element is used to make a choice when there are two or more possible courses of action. It provides a means for conducting multiple conditions testing. The xsl:choose element must contain one or more xsl:when elements and can contain only one optional xsl:otherwise element (which must occur after all …

xsl:choose Read More »

xsl:when

<xsl:when> Syntax: <xsl:choose> <xsl:when test=”expression”> … </xsl:when> … <xsl:otherwise> … </xsl:otherwise> </xsl:choose> The xsl:when element is a child of the xsl:choose element. The xsl:choose element is used to make a choice when there are two or more possible courses of action. It provides a means for conducting multiple condition testing. The xsl:choose element must contain one or more xsl:when elements and can contain only one …

xsl:when Read More »

xsl:otherwise

<xsl:otherwise> Syntax: <xsl:choose> <xsl:when test=”expression”> … </xsl:when> … <xsl:otherwise> … <xsl:otherwise> </xsl:choose> The xsl:otherwise element is an optional child of the xsl:choose element. The xsl:choose element is used to make a choice when there are two or more possible courses of action. It provides a means for conducting multiple conditions testing. The xsl:choose element must contain one or more xsl:when elements and can contain only …

xsl:otherwise Read More »

xsl:message

<xsl:message> Syntax: <xsl:message terminates=”yes” | “no” > </xsl:message> The xsl:message element is primarily used to report errors by displaying a text message and related information of interest in the output. This element can contain almost any other XSL element. For example, you can use the xsl:text element to add literal text to the xsl:message element and you can use the xsl:value-of element to display …

xsl:message Read More »

xsl:variable

<xsl:variable> Syntax: <xsl:variable name=”qname” > </xsl:variable> Or:  <xsl:variable name=”qname” select=”expression” /> The xsl:variable element is used to declare a local or global variable and to give that variable a name and a value. The value can be assigned by either the content of the xsl:variable element or by the select attribute, but not by both. Each variable declaration requires …

xsl:variable Read More »

xsl:decimal-format

<xsl:decimal-format> Syntax: <xsl:decimal-format decimal-separator=”character” digit=”character” grouping-separator=”character” infinity=”string” minus-sign=”character” name=”qname” NaN=”string” pattern-separator=”character” percent=”character” per-mille=”character” zero-digit=”character” /> The xsl:decimal-format element defines the symbols and characters used by the format-number function to convert numbers to strings. This element can be used more than once, but with certain limitations. Each element can have an optional name value assigned to it by …

xsl:decimal-format Read More »

Scroll to Top