📜  XPath字符串函数

📅  最后修改于: 2020-12-26 07:03:06             🧑  作者: Mango

XPath字符串函数

XPath字符串函数列表:

Index Function Description
1) starts-with(string1, string2) It returns true when first string starts with the second string.
2) contains(string1, string2) It returns true when the first string contains the second string.
3) substring(string, offset, length?) It returns a section of the string. The section starts at offset up to the length provided.
4) substring-before(string1, string2) It returns the part of string1 up before the first occurrence of string2.
5) substring-after(string1, string2) It returns the part of string1 after the first occurrence of string2.
6) string-length(string) It returns the length of string in terms of characters.
7) normalize-space(string) It trims the leading and trailing space from string.
8) translate(string1, string2, string3) It returns string1 after any matching characters in string2 have been replaced by the characters in string3.
9) concat(string1, string2, …) It is used to concatenate all strings.
10) format-number(number1, string1, string2) It returns a formatted version of number1 after applying string1 as a format string. String2 is an optional locale string.

XPath字符串函数示例

让我们以一个示例为例,通过遍历每个员工来创建具有其名称和名称长度的元素表。将名字和姓氏连接起来后,将计算员工姓名的长度,然后显示员工详细信息。

Example.xml




   
      Abhiram
      Kushwaha
      Manoj
      15000
   
   
      Akash
      Singh
      Bunty
      25000
   
    
      Brijesh
      Kaushik
      Ballu
      20000
   
    
      Zoya
      Mansoori
      Sonam
      30000
   

范例.xsl


  
   
      
         
            

Employee

Name Length of Name

输出: