📜  XPath节点函数

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

XPath节点功能

XPath表达式要使用的节点上的运算符的列表:

Index Operator Description
1) / It is used to select node under a specific node.
2) // It is used to select node from root node.
3) […] It is used to check node value.
4) | It is used for union of two node sets.

XPath表达式要使用的节点上的函数列表:

Index Function Description
1) node() It is used to select all kinds of nodes.
2) processing-instruction() It is used to select nodes which are processing instruction.
3) text() It is used to select a text node.
4) name() It is used to provide the name of the node.
5) position() It is used to provide the position of the node.
6) last() It is used to select the last node relative to current node;
7) comment() It is used to select nodes which are comments.

XPath节点功能示例

让我们以一个示例为例,通过遍历每个员工来创建一个元素及其详细信息的表。它计算学生节点的位置,然后显示带有序列号的员工详细信息。

Employee.xml:




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

Employee.xsl:


  
   
      
         
            

Employee

Serial No ID First Name Last Name Nick Name Salary

输出: