4.4 function Functions there are many function Functions in XPath that can help us find the desired node accurately. Count () function: counts the number of nodes that meet the condition. Example: pxsl: value-ofselect = "count (PERSON [name = tom] 4.4 function (Functions)
There are many functional functions in XPath that can help us find the desired node accurately.
Count () Efficacy
Purpose: count the number of nodes that meet the condition.
Example:
Clarification: The code is used to display the number of tom attributes in the PERSON element.
Number () function
Purpose: convert the text in the attribute value to a value.
Example:
The number is:
Clarification: The use of code is to show the price of books.
Substring () function
Syntax: substring (value, start, length)
Purpose: Intercept a string.
Example:
Clarification: The purpose of the code is to extract the value of the name element and display it from the beginning of the first letter to the third.
Sum () function
Purpose: sum.
Example:
Total Price =
Clarification: The use of code is to calculate the sum of all prices.
The above functions are only part of the XPath syntax. There are a large number of functional functions that are not prefixed, and the XPath syntax is still evolving. Through these functions, we can implement more complex queries and control.
Here, our course is almost over. Through rapid learning, we hope that you will have a basic concept for XSLT: XSLT is a language for converting XML documents. It contains two processes: conversion and pattern. XSLT is much more powerful than CSS. it has a syntax similar to data query. If you are interested in XSLT, the above knowledge is far from enough and you need to query more materials. In the appendix of the last chapter, Alibaba Cloud provides you with important XSLT resources.