How to define XSLT functions in XML
Posted in
XML | XSLT July 04, 2019
In this article we will discuss about what are XSLT Function and how to use them.
XSLT Function
- XSLT have contain many no of built-in fuction ,it also allow the creation of user-defind function.The default namespace of fuction is fn.
There are some fuction like numeric value date and time comparision ,sequence manipulation and many of more function
- Calling a Function fn:prefix such as fn:string(). Here fn is a default prefix
There are the following built-in XSLT function
The String Functions:
Function |
Descripition |
fn:substring |
A substring based on a starting point and optional length. |
fn:substring-before |
The substring before the first occurrence of a delimiter. |
functx:substring-after |
The substring after the first occurrence of a delimiter. |
functx:substring-after-if-contains |
Performs substring-after, returning the entire string if it does not contain the delimiter. |
functx:substring-after-last |
The substring after the last occurrence of a delimiter. |
function:substring-after-last-match |
The substring after the last text that matches a regex. |
function:substring-after-match |
The substring after the first text that matches a regex |
Function |
Descripition |
fn:matches |
The substring before the last text that matches a regex. |
functx:substring-before-match |
The substring after the first text that matches a regex. |
functx:substring-before-last-match |
The substring after the last text that matches a regex. |
fn:regex-group |
The current group. |
Function |
Descripition |
functx:inbdex-of-string |
The position of a substring |
functx:inbdex-of-string-first |
The first position of a substring. |
functx:inbdex-of-last |
The last position of a substring. |
functx:inbdex-of-match-first |
The first position of a matching substring. |
Function |
Descripition |
fn:contains |
Whether one string contains another. |
functx:contain-word |
Whether one string contains another. |
functx:contains-case-insensitive |
Whether one string contains another, without regard to case. |
functx:contains-any-of |
Whether a string contains any of a sequence of strings. |
fn:starts-with |
Whether one string starts with another. |
fn:ends-with |
Whether one string ends with another. |
Further Readings
You may also want to read these related articles :
Ask Your Question
Ask Your Question Got a programming related question? You may want to post your question here
Programming Answers here