XSL for VBScript, JScript, attribute

xiaoxiao2021-03-06  62

First, AbsolutechildNumber

Meaning: Return the node relative to the serial number of all its brothers (regardless of the name).

Syntax: AbsolutechildNumber (NODE)

Parameters: Node - object, want to return the node of the number.

Example:

1. Assume that the document structure is:

Where Document is a top-level node, the following expression will output:

AbsolutechildNumber (this.selectnodes ('/ document / body'). Item (0))

2. Determine the current node relative to the serial number of all its brothers:

AbsolutechildNumber (this)

Second, AncStorchildNumber

Meaning: From the given junction, the serial number of the nearest ancestral node is returned according to the given ancestor node name (relative to the same name node). Returns 0 if you find no ancestors.

Syntax: AncStorchildNumber (BSTRNODENAME, PNODE)

parameter:

BSTRNODENAME - String. The name of the ancestral node searched.

PNode - object. Search the node of the start position.

Sample lookup current node Recent named Report Ancestors Node:

AnnestorchildNumber ('Report', this)

Third, Attributes

Meaning: Returns a collection of node properties.

Object.attributes

Parameters: Object - Node Objects.

Example: Number of current node properties

this.attributes.length

The value of the current node third attribute

this.attributs.Item (2) .value

Or this.attributes.Item (2) .text

Or this.attributes (2) .Text

Note: If a given subscript is greater than the total sum of the attribute, it will be reduced, the subscript of the first attribute is 0.

Fourth, BaseName

Meaning: Returns the basic name of the namespace restriction, that is, the name prefix is ​​not included.

Grammar: Object.basename

Parameters: Object - Node Object

Example, current node's basic name: this.basename

V. ChildNumber

Meaning: Returns the node relative to the serial number of the same class.

Grammar: ChildNumber (Object)

Parameters: Object - Node Object

Example, assuming that the XML document structure is as follows:

If the current node is Z, ChildNumber (this) returns 1, and AbsolutechildNumber (this) returns 3.

Sixth, Datatype

Meaning: Set or read the data type of the node.

Syntax: Setting Node Data Type Object.DataType = ObjValue Read Node ObjValue = Object.DataType

Parameters: Object - Node Objects. Example, read the data type of the current node:

DTTYPE = this.DataType

Seven, depth

Meaning: The specified node appears in the depth on the document tree, ie the node is located in the second layer, the top-layer node is located at the first layer, the root node (i.e., the node represented by "/") is located at the 0th layer.

Syntax: DEPTH (PNODE)

Parameters: PNODE - Node Object

Example, the depth of the current node:

DEPTH (this)

8. Firstchild, LastChild meaning: Return the first sub-node of the node (or the last sub-node).

Syntax: pnode.firstchild pnode.lastchild

Parameters: PNODE - Node Object

Example, the name of the first node of the current node:

this.firstchild.nodeName

Nine, Formatindex

Meaning: Format the integer provided with the specified count system.

Syntax: Formatindex (Lindex, BStrFormat)

parameter:

LINDEX - integer value or variable

BSTRFORMAT - data format, optional value has a, A, I, I, 1, 01 (very useful in the value of 0 headers, if the number of fixed lengths such as 0001,0002 is required).

Example, capital Roman number number of current node:

Formatindex (ChildNumber (this), 'I')

Ten, FormatNumber

Meaning: The value is output in the specified format.

Grammar: FormatNumber (DBLNumber, BStrFormat)

Parameters: Description With FormatNumber, the difference is that the formatted can be a decimal.

Example, the value of the variable A is formatted to two decimals: FormatNumber (a, '#. 00'):

11. HaschildNodes

Meaning: Returns true if there is a sub-node point, otherwise false (0).

Syntax: pnode.haschildnodes ()

Note: Unlike the functions previously described, this function must have an empty bracket.

Example, determine if the current node has a sub-point:

this.haschildnodes

Twelve, Namespaceuri, Prefix

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

Syntax: pnode.namespaceuri pnode.prifix

Thirteen, nextsibling, previoussibling, ParentNode

Meaning: Return to the next brother (or the previous brother, or the parent of the node).

Syntax: pnode.nextsibling pnode.previoussibling pnode.parentnode

Note: Apply a ParentNode method for root nodes (ie, "/"), apply the previoussibling method for the first child node, apply the nextsibling method for the last child's node, can cause errors, which can pass this relationship operator == (Equal to) and! = (Not equal) to determine if a node is specified node, format is pnode1 = pnode2 or pnode2! = Pnode2.

Fourteen, nodename

Meaning: Returns a specific string of elements, attributes, entrances, or other type of node.

Syntax: pnode.nodeename

Example, the name of the current node:

this.nodename

Fifteen, nodetype, nodetypeString

Meaning: Return the value of the node (or string form). Syntax: pnode.nodetype or pnode.nodetypeString

return value:

Character form node type nodes which node type described Element1'element'Element Attribute2'attribute'Markup-Delimited Region of Text3'text'Processing Instruction7'processing_instruction'Comment8'comment'Document Entity9'document 'sixteen, nodeTypedValue

Meaning: Returns the value of the node with a predefined data type of the node.

Syntax: pnode.nodetyped accuue

Example, assuming that the data type of the current node is fixed.14.4, the following example will return the value of the node with a numerical value, not a text string:

this.nodetypedValue

Seventeenth, NodeValue

Meaning: Returns the text of the node.

Grammar: pnode.nodevalue

Note: This method is not used for elemental siding, available for properties, cdata, annotations, text and other nodes.

Example, the value of the first attribute of the current element:

THIS.Attributes (0) .NodeValue

Text within the current element (assuming that only text in this element, no other elements, TEXT, it is recommended to give more exact usage several times).

this.firstchild.NodeValue

Eighteen, OwnerDocument

Meaning: Returns the root of the document containing the node.

Syntax: pnode.ownerdocument

Note: This method is used for the root node of the document.

19, SelectNodes

Meaning: The given style matching is applied to the current node and returns the collected node collection.

Syntax: pnode.selectnodes ('Pattern')

Tip: Preparation with Pattern

The value of the SELECT property is similar, where "/" indicates from the root of the document from the document; "//" starts all the nodes of the document; ".." indicates the father's finger from the current node. Start; if you want to search from the current node, you can't have the above special characters.

Example, the number of elements with the current node in its parent element:

ChildNumber (this.selectnodes ("../" this.nodeename " [end ()] "). Item (0))

The number of elements named "skill" in the current element:

ChildNumber ("Skill [end ()]"). Item (0))

Twenty, selectsinglenode

Meaning: Similar to SelectNodes, different returns only the first node of the match, rather than the collection.

Grammar: pnode.selectsinglenode ('Pattern')

Example, the number of elements with the current node in its parent element:

ChildNumber (this.selectsinglenode ("./" this.nodeename " [end ()] "))

The number of elements named "skill" in the current element:

ChildNumber (this.selectsinglenode ("Skill [end ()]"))

21, Text

Meaning: Returns the junction with the text content in its subtree.

Syntax: pnode.text

Example, text content inside the entire document: this.ownerDocument.text

Current elements and text content of their subtots:

this.Text

Twenty-two, XML

Meaning: Return nodes and its descendants XML representation.

Syntax: pnode.xml

Example, the XML content of the current document:

this.ownerDocument.xml

There are several functions that are not introduced, listed in response, if you are interested, please visit http://msdn.microsoft.com Get a detailed description.

formatTime (varTime, bstrFormat, varDestLocale) formatDate (varDate, bstrFormat, varDestLocale) apendChild (newChild) definitionCloneNodeinsertBefore (newChild, refChild) parsedremoveChild (oldChild) replaceChild (newChild, oldChild) specifiedtransformNode (stylesheet) transformNodeToObject (stylesheet, outputObject) uniqueID (pNode)

转载请注明原文地址:https://www.9cbs.com/read-111898.html

New Post(0)