VC Core Reference: Command Instruction and Function

This document provides about command instructions and functions defined in the VC core vocabulary.

1. Overview

This section provides about command instructions and functions defined in the VC core vocabulary. For information about an overview of the VC core vocabulary and its elements and attributes, see "VC Core Reference: Element and Attribute."

1.1. Namespace URI Reference

The namespace URI reference of the VC core vocabulary is http://xmlns.xfy.com/xvcd. In the following discussion, we use the namespace prefix "xvcd:" in order to describe the VC core vocabulary's elements, command instructions, and functions.

Also, we use the following vocabularies and their namespace prefixes in the descriptions below.

The attribute is, unless explicitly specified, defined in the same namespace as the element which uses the attribute.

1.2. Sample Code

The xfy Developer's Toolkit distribution package contains sample codes using the VC core vocabulary. After the xfy Developer's Toolkit distribution package is installed, the sample codes using the VC core vocabulary are placed in the following folder:

  • doc/samples/developers/features/xvcd
  • doc/samples/developers/features/editing
  • doc/samples/developers/features/instruction/xvcd-instruction

Many other samples are provided in xfy Developer's Toolkit. To learn more about XVCD, see these samples.

2. Command Instructions for Editing an XML Document

This section explains the command instruction for editing an XML document by each function.

2.1. Operations of DOM

Provides about the command instructions operating the DOM as follows.

  • Node operation
  • Edit at the caret position
  • Operation on the selected range
  • Element manipulation
  • Handling text
  • Setting attribute
Throw of DOMException

If the DOM tree status becomes invalid after the command instruction accompanying the above DOM operation is executed, DOMException is thrown. The conditions where DOMException is thrown comply with the W3C DOM Level2 specification.

2.1.1. Node Operation

In the VC core vocabulary, the elements and attributes defined as command instruction to work with nodes are as follows:

xvcd:delete Instruction

Performs delete operation based on the evaluation result of the XPath expression specified in select attribute. The delete operation may vary according to the evaluation result of the XPath expression. Each case and operation is as follows.

  • If the expression evaluates to node set
    All nodes within the node set will be deleted.
  • If the expression evaluates to range
    The operation may vary according to whether the selected range exists.
    If the selected range exists
    Texts and nodes within the range will be deleted.
    The starting point is the same as the ending point, so the selected range does not exist
    A character at caret position will be deleted according to the backspace attribute.

For information about examples of using xvcd:delete instruction, see "4.2.3. Deleting XML Document Fragment from XML Document Data Structure" of "Creating Vocabulary Component with XVCD"

Attribute:
select (mandatory)

Specifies delete target. It must be an XPath expression. Either of the range or the node set is returned to the evaluation result of the XPath expression.

backspace

Specifies the behavior when a character will be deleted. It must be yes or no. If yes is specified, a character before the caret position will be deleted. If no is specified, a character after the caret position will be deleted.

If omitted, at the behavior to delete a character, the attribute is assumed to be set to no.

Content:

The xvcd:delete element is empty.

xvcd:insert Instruction

Inserts the XML document fragment into the source XML document. Specifies the position into which XML document fragment is inserted using the ref attribute and the position attribute. The caret position after executing a command instruction is determined according to the caret-move attribute value.

For information about examples of using xvcd:insert instruction, see "4.2.2. Adding XML Document Fragment to XML Document Data Structure" of "Creating Vocabulary Component with XVCD"

Attribute:
ref (mandatory)

Specifies the node to insert XML document fragment or specifies range. It must be an XPath expression. The reference node of the insert position can be the node specified in the ref attribute, or range. If the node specified in the ref attribute does not exist, the command instruction is not executed. Or, if the specified node is invalid, an error occurs.

position

Specifies the insert position of the XML document fragment relative to the reference node specified in the ref attribute. This should be described in one of the following strings: The attribute value template can be used.

before
Inserts XML document fragment before the reference node.
after
Inserts XML document fragment after the reference node.
first-child
Inserts XML document fragment as first child node of the reference node.
last-child
Inserts XML document fragment as last child node of the reference node.
caret
Divides the reference node at caret position and inserts XML document fragment.

If omitted, before is assumed to be specified.

select

Specify, using node set, the XML document fragment to be inserted into the source XML document. It must be an XPath expression.

If omitted, the content described within the element will be inserted. Here, if the element is empty, an error occurs.

combine

Specifies the combination of the inserted node of the XML document fragment and the separated node at the inserted position when caret is set to the position attribute. This should be described in one of the following strings: The attribute value template can be used.

both
Combines the inserted and the resulting separated nodes.
preceding
Combines the separated preceding node and the inserted node.
after
Combines the behind separated node and the inserted node.
none
Does not combine nodes.

Combining nodes is performed when the inserted and separated node are the same type.

If omitted, both is assumed to be set.

caret-move

Specifies the caret position after an XML document fragment is inserted. This should be described in one of the following strings: The attribute value template can be used.

before
Moves the caret before the inserted XML document fragment.
after
Moves the caret after the inserted XML document fragment.
none
Does not move the current caret position.

If omitted, before is assumed to be set.

Content:

Any source XML document fragment for the XML document to be inserted can be described within the xvcd:insert element. The described XML document fragment is converted by VC. If the content is described in the element and the select attribute is specified, the value of the select attribute takes precedence.

xvcd:move Instruction

Moves the XML document fragment in the source XML document to the specified position.

For information about examples of using xvcd:move instruction, see "4.3. Moving XML Document Fragment through Combination of Keys" of "Creating Vocabulary Component Responding to User Operations".

Attribute:
select (mandatory)

Specify, using node set, the XML document fragment to move. It must be an XPath expression.

ref (mandatory)

Specifies the destination node of the XML document fragment or specifies range. It must be an XPath expression. The reference node of destination can be the node specified in the ref attribute, or range. If the node specified in the ref attribute does not exist, the command instruction is not executed. Or, if the specified node is invalid, an error occurs.

position

Specifies the insert position of the XML document fragment relative to the reference node specified in the ref attribute. This should be described in one of the following strings: The attribute value template can be used.

before
Inserts XML document fragment before the reference node.
after
Inserts XML document fragment after the reference node.
first-child
Inserts XML document fragment as first child node of the reference node.
last-child
Inserts XML document fragment as last child node of the reference node.

If omitted, before is assumed to be specified.

Content:

The xvcd:move element is empty.

2.1.2. Operation on the Selected Range

xvcd:copy-selection Instruction

Copies the selected range as XML document fragment in canvas and stores it to a variable.

Attribute:
return-to (mandatory)

Specifies the variable which stores the copied XML document fragment. It must be a QName.

Content:

The xvcd:copy-selection element is empty.

2.1.3. Element Manipulation

In the VC core vocabulary, the elements and attributes defined as command instruction to work with elements are as follows:

xvcd:surround-contents Instruction

Encloses the selected range of the string in the text node with the specified element. Does nothing when the selected range contains multiple nodes. If the range is not selected, an empty element is inserted at the caret position.

Attribute:
parent-name (mandatory)

Describe the name of the element in which the selected range is enclosed. It must be a QName. The attribute value template can be used.

parent-namespace

Describe the namespace of the element in which the selected range is enclosed. It must be an URI reference string. The attribute value template can be used.

If omitted, the namespace URI reference that expands the prefix of parent-name is used.

Content:

The xvcd:surround-contents element is empty.

xvcd:unsurround-contents Instruction

Deletes the element tag of the element node included in the specified node set. Does nothing to nodes other than the element nodes in the specified node set.

Attribute:
select (mandatory)

Specifies the node set which deletes the element tag. It must be an XPath expression.

Content:

The xvcd:unsurround-contents element is empty.

xvcd:combine Instruction

Combines two contiguous nodes. The each node to be combined must be the node of the same type. Between the specified node and the target node, comment nodes or text node which consists of only whitespace characters are ignored during combining.

If the attributes set to the combined nodes are different, the attribute set to the preceding node in the document order is reflected to the combined node.

If two nodes to be combined are elements and each element has a different element name, the name of the preceding element in the document order becomes the name of the combined element.

If select attribute is specified, the node specified by select attribute is combined with the previous node (if to attribute value is before) or with the node after it (if to attribute value is after).

If select attribute is not specified, whether to be able to combine or not depends on the following conditions:

  • Main element (compliant with xvcd:main-elements element) exists on the ancestor node of the node at the caret position (if multiple elements exists, the element nearest to the caret is selected).
  • If to attribute value is before, the caret position points the head of the text or the object included in the main element.
  • If to attribute value is after, the caret position points the end of the text or the object included in the main element.

If the condition is satisfied, whether to combine the main element and the target element by type attribute of xvcd:main-elements element (main combination) is judged. If the condition is not satisfied, the operation described in the xvcd:default element is performed. If xvcd:default is omitted, nothing happens.

If the main combination is performed, then it attempts to combine the newly adjoining child nodes (sub-combination). If the candidate node for the combination complies with the sub-element (complying with the xvcd:sub-elements element), ability to combine by using the type attribute of the xvcd:sub-elements element is judged. If the candidate node is text node, it is always combined.

If the sub-combination is performed, then it attempts to combine the child nodes sub-combination at the combination point.

For information about examples of using xvcd:combine instruction, see "4.2. Combining XML Document Fragment Using Delete and Backspace Keys" of "Creating Vocabulary Component Responding to User Operations".

Attribute:
select

Specifies target node to combine. It must be an XPath expression.

If omitted, combines according to the element described within the contents.

to

Specifies the direction of combination for combined nodes. It must be before or after. The attribute value template can be used.

If omitted, after is set.

Content:

The elements available in the xvcd:combine element are listed below: The element described in the content is used when the select attribute is omitted.

xvcd:split Instruction

Divides the node into two at caret position.

If the select attribute is specified, the node indicated by the select attribute is separated into two nodes at the caret position.

If the select attribute is not specified, the node is separated only when the conditions listed below are satisfied.

  • Main element (compliant with xvcd:main-elements element) exists on the ancestor node of the node at the caret position (if multiple elements exists, the element nearest to the caret is selected).
  • The node can be separated for all of these: the node at the caret position, the node of the selected main element, and all the nodes which exist between them.
  • Always can be separated if it is text node, separated if the element complies with the xvcd:main-elements or xvcd:sub-elements element, otherwise unable to be separated.

For information about examples of using xvcd:split instruction, see "4.1. Splitting XML Document Fragments with the Enter Key of "Creating Vocabulary Component Responding to User Operations".

Attribute:
select

Specifies the target node to divide. It must be an XPath expression.

If omitted, separates according to the element described within the contents.

Content:

The elements available in the xvcd:split element are listed below: The element described in the content is used when the select attribute is omitted.

xvcd:main-elements Element

Describes the condition for combining elements by the xvcd:combine element, or separating an element by the xvcd:split element. Available only within the contents of the xvcd:combine element and the xvcd:split element.

The element of the element group specified by this element can be the apex for the combination or separation.

Attribute:
test (mandatory)

Describes an XPath expression which represents the condition for combining or separating the element. The evaluation result of the XPath expression is a boolean value. If it is true, elements are combined or separated. When evaluating XPath expression, the combined or separated node is the context node.

type

Specifies the condition for the node combination. Specifies one of the following strings.

grouped
Enables it to combine elements if the target nodes are included in the same group.
strict
Enables it to combine elements if target nodes are element nodes, and all the element names and their attribute values match each other.

If described within the xvcd:split element, the type attribute can be omitted. If described within the xvcd:combine element and omitted, the grouped is assumed to be specified.

Content:

The xvcd:main-elements element is empty.

xvcd:sub-elements Element

Describes the condition for combining elements by the xvcd:combine element, or separating an element by the xvcd:split element. Available only within the contents of the xvcd:combine element and the xvcd:split element.

This element is not the top of the node tree combined or separated, but specifies the element group that is the child of the node.

Attribute:
test (mandatory)

Describes an XPath expression which represents the condition for combining or separating the element. The evaluation result of the XPath expression is a boolean value. If it is true, elements are combined or separated. When evaluating XPath expression, the combined or separated element is the context node.

type

Specifies the condition for the element combination. This should be described in one of the following strings:

grouped
Enables it to combine elements if the target elements are included in the same group.
strict
Enables it to combine elements if all the attribute values set to the element names or elements match together within the target element.

If described within the xvcd:split element, the type attribute can be omitted. If described within the xvcd:combine element and omitted, the grouped is assumed to be specified.

Content:

The xvcd:sub-elements element is empty.

xvcd:default Element

Describes the process to be performed if the node cannot be combined by the xvcd:combine element, or cannot be separated by the xvcd:split element. Available only within the contents of the xvcd:combine element and the xvcd:split element.

Attribute:
command

Specifies the command name to execute. It must be a QName.

If omitted, the command instruction column described within the xvcd:default element is executed. If both the command attribute and command instruction column are described at the same time, the specification within the command attribute takes precedence, and the command instruction column is ignored.

Content:

The following content can be described within xvcd:default element as command instruction column:

2.1.4. Handling Text

In the VC core vocabulary, elements and attributes defined as command instruction for using to handle text are as follows:

xvcd:set-text Instruction

Replaces text data of the node specified in XPath expression with other text data.

Attribute:
select (mandatory)

Specifies the text data whose content is replaced. It must be an XPath expression which identifies the node. Depending on the node type retrieved by evaluating XPath expression, the way to determine target text data may vary.

  • If the resulting node is a text node, the contents of the node are replaced with the value attribute's value.
  • If it is an attribute node, the attribute value is replaced with the value attribute's value.
  • If it is an element node, the target text node is determined by the position attribute.

If the specified XPath expression satisfies the following conditions, the text data is specified by complementing the element or attribute within the XPath. If the element is complemented, it is inserted as the first child node of the parent node.

  1. The predicate is not described in each location step of the XPath expression.
  2. The axis used is only the child axis or the attribute axis.
  3. The node test is described in QName.
value (mandatory)

Sets the text data which is replaced to. It must be a string. The attribute value template can be used.

position

Specifies the position of the text node that sets the text data if the node specified by the select attribute is an element node. Describes one of the following strings.

before
Sets the text data to the immediately preceding text node of the element node. If no immediately preceding node exists, or the immediately preceding is not text node, it sets the text data by inserting the text node immediately preceding it.
after
Sets the text data to the immediately following text node of the element node. If no immediately following node exists, or the immediately following is not text node, it sets the text data by inserting the text node immediately following it.
first-child
Sets the text data to the text node which is the first child of the element node. If no child node exists, or the first child node is not text node, it sets the text data by inserting the text node at the head of it.
last-child
Sets the text data to the text node which is the last child of the element node. If no child node exists, or the child of the end node is not text node, it sets the text data by inserting the text node at the end of it.

If omitted, the first-child is assumed to be set.

Content:

The xvcd:set-text element is empty.

2.1.5. Setting Attribute

In the VC core vocabulary, elements and attributes defined as command instruction for setting a attribute are as follows:

xvcd:set-attribute Instruction

Sets attribute to all elements included in the specified node set or deletes attribute from all elements.

Attribute:
select (mandatory)

Specifies the node set to set or delete an attribute. It must be an XPath expression.

name (mandatory)

Describe an attribute name. It must be a QName. The attribute value template can be used.

value

Describe the value which is set to attribute. It must be a string. The attribute value template can be used.

If omitted, the attribute whose name is specified in the name attribute is deleted from the element.

caret-move

Specifies the caret position after setting or deleting an attribute. This should be described in one of the following strings: The attribute value template can be used. If there are multiple attributes to set or delete, move the caret to the first attribute.

before
Move the caret to the top of the string of the value in the specified attribute.
When the attribute is deleted, move the caret to the top of the element to which the attribute is set.
after
Move the caret to the end of the string of the value in the specified attribute.
When the attribute is deleted, move the caret to the top of the element to which the attribute is set.
none
The caret remains to its current position.

If omitted, before is assumed to be set.

Content:

The xvcd:set-attribute element is empty.

2.2. Clipboard Operation

In the VC core vocabulary, elements and attributes defined as command instruction for work with clipboard are as follows:

xvcd:get-clip Instruction

Retrieves XML document fragment in the clipboard and stores it to a variable.

Attribute:
return-to (mandatory)

Specifies the variable which stores XML document fragment in the clipboard. It must be a QName. The XML document fragment stored in the variable specified in return-to attribute contains the following elements:

Content:

The xvcd:get-clip element is empty.

xvcd:set-clip Instruction

Transfers the specified node set to the clipboard.

For the node set, specify the XML document fragment described in the data conversion vocabulary. If an XML document fragment that is not a data conversion vocabulary is specified as the target, it is compensated according to "Compensation of data conversion." For more information about the data conversion vocabulary, see "Data Conversion Reference."

Attribute:
select

Specifies the node set which is send to the clipboard. It must be an XPath expression.

If omitted, the content described in the element is send to the clipboard.

Content:

Any source XML document fragment for the node set to be send to the clipboard can be described in the xvcd:set-clip element. The described XML document fragment is converted by VC. If the content is described in the element and the select attribute is specified, the value of the select attribute takes precedence.

2.3. Editing Data Operation

In the VC core vocabulary, elements and attributes defined as command instruction for handling the data to edit are as follows:

xvcd:set-property Instruction

Changes the value of the property defined within the xvcd:property element.

Attribute:
name (mandatory)

Specifies the name of the property whose value you want to change. It must be a QName. The attribute value template can be used. The property name must described with a namespace prefix.

value (mandatory)

Describe the value which is set to property. It must be a string. The attribute value template can be used.

Content:

The xvcd:set-property element is empty.

xvcd:set-user-data Instruction

Sets the value of user data. If user data with the same name is already defined by the xvcd:user-data element, its value is changed.

Attribute:
name (mandatory)

Specifies the name of user data to set or change its value. It must be a QName. The attribute value template can be used.

value (mandatory)

Describe the value which is set to user data. It must be a string. The attribute value template can be used.

select

Specifies the node set to which user data is assigned. It must be an XPath expression.

If omitted, the user data is assigned to the root node of the source XML document to which the vocabulary is applied.

Content:

The xvcd:set-user-data element is empty.

2.4. Corresponding to User Operations

In the VC core vocabulary, elements and attributes defined as command instruction for using to correspond to user operations are as follows:

xvcd:start-drag Instruction

Prompts to start a drag-and-drop operation when drag start event is received. Specifies the object to be dragged.

For the dragging target, specify the XML document fragment described in the data conversion vocabulary. If an XML document fragment that is not a data conversion vocabulary is specified as the target, it is compensated according to "Compensation of data conversion." For more information about the data conversion vocabulary, see "Data Conversion Reference."

For more information about how to describe the process of starting the drag using xvcd:start-drag instruction, see "Procedures to Describe a Drag-and-Drop Process".

Attribute:
event (mandatory)

Sets the event object.

Content:

Any source XML document fragment for the XML document to be drugged can be described within the xvcd:start-drag element. The described XML document fragment is converted by VC. To drag-and-drop the selected range, create an XML document fragment by using the xvcd:copy-selection element and output the fragment by using the xvcd:copy-of element.

3. Functions

This section explains the functions defined in the VC core vocabulary by each function.

Namespace for Function

In order to improve the compatibility with XSLT, the following functions can be invoked without namespace (namespace URI reference is empty string) only when they are used in XVCD. However, we recommend you to specify namespace as much as possible.

3.1. Node Manipulation Functions

The functions defined in the VC core vocabulary to handle nodes are listed below.

xvcd:caret-node Function

Returns the node at caret position as the node set.

For information about examples of using xvcd:caret-node() function, see "4.2.3. Deleting XML Document Fragment from XML Document Data Structure" of "Creating Vocabulary Component with XVCD"

Syntax:
node-set xvcd:caret-node( )
Arguments:

No argument.

Return Value:
node-set

Returns the node at caret position as the node set. If caret does not exists, a empty node set is returned.

xvcd:caret-container Function

Returns the container node at caret position as the node set.

Syntax:
node-set xvcd:caret-container( )
Arguments:

No argument.

Return Value:
node-set

Returns the container node at caret position as the node set. If caret does not exists in the editing document, a empty node set is returned.

xvcd:readonly-dom Function

Checks whether the DOM tree containing the target node is reference only.

Syntax:
boolean xvcd:readonly-dom( reference-node? )
Arguments:
node-set reference-node

Specifies the target node.

If omitted, the context node is assumed to be the target node.

Return Value:
boolean

Returns true if the DOM tree containing the target node is reference only. If it is not reference only, false is returned.

xvcd:key Function

Returns the node set to which the specified key is associated by xvcd:key element.

Syntax:
node-set xvcd:key( name, value )
Arguments:
string name

Specifies the key name by QName.

object value

Specifies the key value. If the value is node-set, multiple strings to which each node evaluated are set as value. If the value is other than node-set, string that evaluated to single string is set as a value.

Return Value:
node-set

Returns all nodes as node set that have the specified key.

xvcd:apex-element Function

Returns an apex element of the vocabulary containing the current node.

Syntax:
node-set xvcd:apex-element( )
Arguments:

No argument.

Return Value:
node-set

Returns the node set which contains only the apex element.

3.2. Selection Functions

The functions defined in the VC core vocabulary to handle the selected node or range are listed below.

xvcd:node-selected Function

Returns whether a node of the destination DOM tree is selected.

Syntax:
boolean xvcd:node-selected( )
Arguments:

No argument.

Return Value:
boolean

Returns a boolean value indicating whether a node of the destination DOM tree is selected. Returns true when the node is selected. Returns false when the node is not selected.

xvcd:selection-range Function

Returns the object which represents the selected range. The object representing the selected range is always returned regardless of whether the selected range exists. This function is used to get a range, for example, in ref attribute of the xvcd:insert instruction or in select attribute of the xvcd:delete instruction.

Syntax:
range xvcd:selection-range( )
Arguments:

No argument.

Return Value:
range

Returns the object which represents the selected range.

xvcd:selection-collapsed Function

Returns whether the range selected in the destination DOM tree exists.

Syntax:
boolean xvcd:selection-collapsed( )
Arguments:

No argument.

Return Value:
boolean

Returns a boolean value indicating whether the range selected in the destination DOM tree exists. If the selected range does not exist, true is returned. If the property exists, it returns false.

3.3. Editing Data Functions

The functions defined in the VC core vocabulary to handle data to edit such as variables and property are listed below.

xvcd:user-data Function

Retrieves the user data's value from the node.

Syntax:
string xvcd:user-data( userdata-name, node-set? )
Arguments:
string userdata-name

Specifies the name of user data for retrieving its value. It must be a QName.

node-set node-set

Specifies the node to which user data for obtaining its value is assigned in XPath expression. If there exists multiple nodes which comply with XPath expression, the first node is selected as the target.

If omitted, the root node of the source XML document applied by vocabulary is intended for.

Return Value:
string

Returns user data's value. If user data with the name specified by userdata-name does not exist, it returns a empty string.

xvcd:property Function

Retrieves the system property's value.

Syntax:
string xvcd:property( property-name, default-value? )
Arguments:
string property-name

Specifies the name of property for retrieving its value. It must be a QName. The property name must described with a namespace prefix.

string default-value

Specifies the value that is returned if the property with the name specified by property-name does not exist.

If omitted, an empty string is returned when the property with the name specified by property-name does not exist. In order to check whether the property exists, use the xvcd:property-exists() function.

Return Value:
string

Returns property's value. If the property with the name specified by property-name does not exist, the default value specified by default-value is returned. In this case, if the default-value value is omitted, an empty string is returned.

xvcd:property-exists Function

Checks whether the property with the name exists, by specifying property name.

Syntax:
boolean xvcd:property-exists( property-name )
Arguments:
string property-name

Specifies the name of the property whose existence you want to check. It must be a QName. The property name must described with a namespace prefix.

Return Value:
boolean

Returns a boolean value. If the property with the name specified by an argument exists, it returns true. If the property does not exist, it returns false.

3.4. Resource File Functions

The functions defined in the VC core vocabulary to handle resource files are listed below.

xvcd:string-resource Function

Retrieves and returns the string resource with the key passed by an argument from the resource file specified by the xvcd:resource element.

For more information about how to obtain the string resource using the xvcd:string-resource() function, see "Use of Resource File".

Syntax:
string xvcd:string-resource( resource-key )
Arguments:
string resource-key

Specifies the key string of the string resource described in the resource file.

Return Value:
string

Retrieves the string resource with the key specified by an argument from the resource file specified by the xvcd:resource element, and returns it in string format. If the string resource with the key specified by the argument does not exist, an error occurs.

xvcd:url-resource Function

Retrieves and returns the URL resource with the key passed by an argument from the resource file specified by the xvcd:resource element.

For more information about how to obtain the URL resource using the xvcd:url-resource() function, see "Use of Resource File".

Syntax:
string xvcd:url-resource( resource-key )
Arguments:
string resource-key

Specifies the key string of the URL resource described in the resource file.

Return Value:
string

Retrieves the URL resource with the key specified by an argument from the resource file specified by the xvcd:resource element, and returns it in URL string format. If the URL resource with the key specified by the argument does not exist, an error occurs.

3.5. Document Load Function

The functions defined in the VC core vocabulary to load another document are listed below.

xvcd:document Function

Loads another document. This function is compatible with XSLT document() function.

Syntax:
node-set xvcd:document( object, base-node? )
Arguments:
object object

Specifies an URI reference of the document to load. Specifies the node set or string.
If the specified value is node set, each node evaluates to string, and loads a document based on the string as URI reference. If the specified value is not node set, the value evaluates to string, and loads a document based on the string as URI reference.

node-set base-node

If URI reference specified by first argument is relative path, specify base URI to convert it to absolute path. It must be a node.

If node set is specified as first argument, uses the node. Otherwise, uses the node in XVCD where this function is described.

Return Value:
node-set

Returns the node set containing the root node of all loaded documents.

3.6. Tool functions

The tool functions defined in the VC core vocabulary available for string operations and so on are listed below.

xvcd:caret-char-offset Function

Returns the caret position offset from the beginning of the text node when the caret points the text node.

Syntax:
number xvcd:caret-char-offset( )
Arguments:

No argument.

Return Value:
number

Returns the offset position from the beginning of the text node. The minimum value is zero, and the maximum value is the number of characters of the text node. If the caret is not within the text node, -1 is returned.

xvcd:caret-char-count Function

Returns the number of characters included in the text node when the caret points to the text node.

Syntax:
number xvcd:caret-char-count( )
Arguments:

No argument.

Return Value:
number

Returns the number of characters included in the text node. If the caret is not within the text node, -1 is returned.

xvcd:format-number Function

Converts a numeric value to formatted string by using specified format pattern string and decimal number format.

Syntax:
string xvcd:format-number( number, pattern, name? )
Arguments:
number number

Specifies a numeric value to output.

string pattern

Specifies format pattern string used when outputting numeric value.

string name

Specifies the name of decimal number format applied to numeric value by QName.
The decimal number format is specified in xvcd:decimal-format element.

If omitted, uses default decimal number format string.

Return Value:
string

Returns the formatted numeric string.