Introduction to XSL Functions (2)

Source: Internet
Author: User
Tags integer xsl

VI. DataType

Meaning: Sets or reads the data type of a node

Syntax: Setting the data type of a node object.datatype=objvalue

Read the data type of the node objvalue=object.datatype

Parameters: object── Node Object

Example: Reading the data type of the current node

Dttype=this.datatype

Seven, depth

Meaning: Specifies the depth at which the node appears on the document tree, where the node is at the top level of the document, and the top-level node is located in the

The first layer, the root node (that is, the node represented by "/") is located on the No. 0 floor.

Syntax: Depth (pnode)

Parameters: pnode── Node Object

Example: The depth of the current node

Depth (this)

Viii. FirstChild, LastChild

Meaning: Returns the first child node (or last child node) of a node.

Syntax: Pnode.firstchild

Pnode.lastchild

Parameters: pnode── Node Object

Example: The name of the first node in the current node

This.firstChild.nodeName

Nine, Formatindex

Meaning: The supplied integer is formatted with the specified count system.

Syntax: Formatindex (lindex, Bstrformat)

Parameters:

lindex── integer value or variable

bstrformat── data format, optional values are a, a, I, I, 1, 01 (in 0-based numerical form, if required fixed-length numbers such as 0001, 0002 is very useful)

Example: uppercase Roman numeral number for the current node

Formatindex (Childnumber (this), "I")

Ten, FormatNumber

Meaning: Outputs a value in the specified format.

Syntax: FormatNumber (Dblnumber, Bstrformat)

Parameters: Description Same as FormatNumber, except that the format can be decimal

Example: The value of variable A is formatted as two decimal formatnumber (A, "#.00")

Xi. HasChildNodes

Meaning: Returns True (-1) If the node has a child node, or False (0)

Syntax: Pnode.haschildnodes ()

Note: Unlike the function described earlier, this function must be preceded by an empty bracket

Example: determining whether the current node has child nodes

This.haschildnodes

12, NamespaceURI, prefix

Meaning: Returns the global resource identifier (or prefix) of the node namespace

Syntax: Pnode.namespaceuri

Pnode.prifix

13, NextSibling, PreviousSibling, parentnode

Meaning: Returns the next sibling of the node (or the parent node of the previous sibling, or node)

Syntax: pnode.nextsibling

Pnode.previoussibling

Pnode.parentnode

Note: Applying the ParentNode method to the root node (that is, "/"), applying the PreviousSibling method to the first child node, and applying the NextSibling method to the last child node will result in an error that can be passed through the relational operator = = (equals) and the!= (Not equal) to determine whether a node is a specified node, in the form of pNode1 = PNode2 or PNode2!= pNode2.

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.