Step 4: XPath syntax (3)

Source: Internet
Author: User
Tags xslt
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.