For example, to use the JavaScript implementation of math: Whether the extension function you use is built into your processor or is a user-defined extension function, it’s good practice to test that the function is supported before you use it. The default is ‘ascending’. Before looking at the first template rule’s individual function calls, let’s look at the result of the stylesheet, which you can run with any well-formed XML file as its source: You can use the extension-element-prefixes attribute to prevent the extension namespaces from being output in the result tree:.


Uploader: Basar
Date Added: 21 June 2009
File Size: 42.15 Mb
Operating Systems: Windows NT/2000/XP/2003/2003/7/8/10 MacOS 10/X
Downloads: 7120
Price: Free* [*Free Regsitration Required]

If you want to use only one particular function, but want to provide a portable stylesheet that can be used with lots of different processors, then you should use the function-level packages that we provide on the site.

This limits the esslt of template matching, the definition of keys and the things that a node set can be sorted on. It therefore makes sense to allow stylesheet authors to define extension functions using XSLT instructions – the implementation may not be as efficient as it would be in, say, Java, but at least it can be supported across platforms and implementations, and limits the number of langauges that stylesheet authors have to learn.

There are two ways that you can make sure that your stylesheet doesn’t break when you use an extension element.

Extensions to XSLT (EXSLT ) – Functions

This function can be used to search in documents other than the one holding the context node, but will return the first URL that it finds; if the entity is defined with different URLs in different documents, then only the first document given in the node set specified as the second argument when considered in document order will be returned.


The default is exelt. This has been informed and inspired by discussions on XSL-List with:. An alternative is described in [ FXPath ]. For example, to test whether the grp: Thus, the following is an unrecoverable error:. Thus, it is an error if the qualified name specified does not have a prefix.


Extension elements give added functionality to XSLT. An XSLT processor may signal the error; if it does not signal the error, it must recover by using the function definition that occurs last in the stylesheet. If the first node in the second node set is not contained in the first node set, then an empty node set is returned.

In exstl cases, you need to point the processor at an implementation of the function that it can use. You can find exlt namespace that you need to define on the page describing the module for the functions that you want to use.


In some processors in particular Saxonthis only works if the element has been categorised as an instruction; it does not work for top-level elements. It is an error if an exsl: Have a look at the How To This page was last edited on 5 Mayat All of the example files used in this tutorial the XSL stylesheet and the XML instance document are available for free download — just unzip the files to a directory, download, Stylus Studio, open the.

The following is an error if the value of the context node when the function is called is equal to the string ‘yes’as two exsl: The third and fourth arguments operate in the same way as the two arguments to document.


It has two template rules: If you’re exsly a production exsltt, you should still think about how an XSLT 2. The second and third arguments operate in the same way as the two arguments to document. This article needs more links to other articles to help integrate it into the encyclopedia.

EXSLT extensions

If the third argument is ‘number’ then the sort value is the string value of each node converted to a number as by the number function.

Because they expect their arguments in radians, and I think about trigonometry in degrees, I specified arguments in degrees and divided each by The function returns a list of the nodes with the duplicates an extra 2 and an extra 8 removed.

Thus, an extension element is required to allow users to define functions that involve returning node sets consisting of existing nodes. Templates are instantiated to create RTFs, but exsl: From Wikipedia, exsot free encyclopedia. This document has no official standing and has not been considered nor approved by any organization.

It is an error if the namespace URI of the expanded name of the function is null – extension functions must not be in a null namespace.