The function | is reproduced in: China XML Forum
This issue introduces multiple XSL methods and attributes for VBScript, JScript, to give full play to the XML advantages for < Xsl:script >, < xsl:eval > Markup Expression Authoring or < Xsl:if >, < xsl:when > Expr attribute.
First, Absolutechildnumber
Meaning: Returns the ordinal number of a node relative to all its siblings (regardless of the name)
Syntax: Absolutechildnumber (node)
Parameters: node── object, to return the number of nodes.
Example:
1. Assume that the document structure is:< documents >< head/>< body/></document, where documentation is the top-level node and the following expression outputs
< Xsl:eval >
Absolutechildnumber (This.selectnodes ("/document/body"). Item (0))
</xsl:eval >
2. Determine the serial number of the current node relative to all of its brothers
< Xsl:eval >absolutechildnumber (this) </xsl:eval >
Second, Ancestorchildnumber
Meaning: Returns the ordinal number of the nearest ancestor node (relative to the same node) based on the given ancestor node name, starting at the given node. Returns 0 if the ancestor is not found.
Syntax: Ancestorchildnumber (Bstrnodename, Pnode)
Parameters:
bstrnodename── string. The name of the ancestor node being searched.
pnode── object. The node where the search starts.
Example:
Finds the nearest name of the current node, called the statement ancestor node.
Ancestorchildnumber ("The", this)
Third, attributes
Meaning: Returns a collection of node attributes
Syntax: object.attributes
Parameters: object── Node Object
Example:
Number of current node properties
This.attributes.length
The value of the third property of the current node
This.attributs.item (2). value
or This.attributes.item (2). Text
or This.attributes (2). Text
Note: If the given subscript is larger than the property sum minus 1, the subscript for the first property is 0.
Four, BaseName
Meaning: Returns the base name with a namespace limit, that is, not including the name prefix
Syntax: Object.basename
Parameters: object── Node Object
Example: the base name of the current node: this.basename
Five, Childnumber
Meaning: Returns the ordinal number of a node relative to a sibling of the same name
Syntax: Childnumber (object)
Parameter: object─? Cape Leng Yun?/p>
Example: Assuming that the XML document is structured as follows
< x >< y >< z >< z/>< y/></x >
If the current node is Z, Childnumber (this) returns 1, and Absolutechildnumber (this) returns 3.
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.
14, NodeName
Meaning: Returns a specific string of elements, attributes, entry names, or other types of nodes
Syntax: Pnode.nodename
Example: The name of the current node
This.nodename
XV, NodeType, nodetypestring
Meaning: Returns the numeric form (or string form) of the type of the knot.
Syntax: Pnode.nodetype or pnode.nodetypestring
return value:
Node type
Node type number node type string
Elements
1
"Element"
Element attributes
2
"Attribute"
markup-delimited Region of Text
3
"Text"
Processing instruction
7
"Processing_instruction"
Comment
8
"Comment"
Document Entity
9
"Document"
16, nodetypedvalue
Meaning: Returns the value of a node as a node-predefined data type
Syntax: pnode.nodetypedvalue
Example: Assuming the data type of the current node is fixed.14.4, the following example returns the value of the node as a number, rather than a literal string
this.nodetypedValue
17, nodevalue
Meaning: Returns the text of a node
Syntax: Pnode.nodevalue
Note: This method is not used for element class nodes and can be used for attributes, CDATA, annotations, text, and so on.
Example: The value of the first property of the current element
This.attributes (0). Nodevalue
The text within the current element (assuming that there is only text in the element, no other elements, that is, < Mark >text</mark), and it is recommended that you try to master its exact usage several times.
This.firstChild.nodeValue
18, Ownerdocument
Meaning: Returns the root of the document that contains the node
Syntax: pnode.ownerdocument
Note: This method is used for document root node errors
19, SelectNodes
Meaning: The given style match applies to the current node and returns a matching set of nodes
Syntax: pnode.selectnodes ("pattern")
Tip: Pattern writing is similar to the value of the Select property of < Xsl:for-each >, which begins with "/"
Searches from the root of the document, traversing all nodes of the document with a "//" beginning table; Beginning
Represents the beginning of the parent node of the current node, and cannot have the above special characters if you want to search down from the current node.
Example: the number of elements with the same name as the current node within their parent element
Childnumber (This.selectnodes) (". /"+this.nodename+" [end ()]]. Item (0))
Number of elements in the current element whose name is "skill"
Childnumber (This.selectnodes ("Skill[end ()]"). Item (0))
20, selectSingleNode
Meaning: Similar to selectnodes, different returns only the first node of the match, not the set of nodes.
Syntax: Pnode.selectsinglenode ("pattern")
Example: the number of elements with the same name as the current node within their parent element
Childnumber (This.selectsinglenode) (". /"+this.nodename+" [end ()]))
Number of elements in the current element whose name is "skill"
Childnumber (This.selectsinglenode ("Skill[end ())")
21, text
Meaning: Returns the text content within the node and its subtree
Syntax: Pnode.text
Example: text content throughout a document
This.ownerDocument.text
The text content of the current element and its subtree
This.text
22, XML
Meaning: XML representation that returns the node and its descendants
Syntax: Pnode.xml
Example: XML content for the current document
This.ownerDocument.xml
A few other functions are not introduced, listed below for reference, such as interested, please visit http://msdn.microsoft.com for detailed instructions.
Formattime (Vartime, Bstrformat,vardestlocale)
FormatDate (Vardate, Bstrformat,vardestlocale)
Apendchild (newchild)
Definition
CloneNode
InsertBefore (newchild, Refchild)
Parsed
RemoveChild (Oldchild)
ReplaceChild (newchild, Oldchild)
Specified
Transformnode (stylesheet)
transformNodeToObject (Stylesheet,outputobject)
UniqueID (Pnode)