VC Core Reference: Elements and Attributes

This document provides an overview of the VC core vocabulary, and its elements and attributes.

1. Overview

This section provides an overview of VC core vocabulary.

1.1. Features and Usage

The vocabulary for describing various core features of VC, such as converting XML documents, responding to user operations (or actions), and providing command instructions for editing documents. You write your XVCD using mainly this vocabulary in conjunction with those for other common features. The elements defined in VC core vocabulary may be classified into the following features:

  • Vocabulary association, conversion
  • Assignment of response to user operation
  • Command Instruction for editing an XML document
  • Defining a command
  • Variable management to use during XML document editing

1.2. Namespace URI Reference

The namespace URI reference of the VC core vocabulary is http://xmlns.xfy.com/xvcd. In the descriptions below, we use the namespace prefix xvcd: for an element used in the VC core vocabulary.

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

We also use the namespace prefix xsl: for an element used in the XSLT. The attribute is, unless explicitly specified, defined in the same namespace as the element which uses the attribute.

1.3. 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. Elements and Attributes Belong to VC Core Vocabulary

This section explains elements and attributes belonging to the VC core vocabulary by the function. About the command instruction and the function belonging to the VC core vocabulary, see "VC Core Reference: Command Instruction and Function".

2.1. Root Element

The root element of VC core vocabulary is xvcd:xvcd element.

xvcd:xvcd Element

This element is the root element when you describe XVCD, including namespaces used in all VCs. All XVCD contents need to be described within this element.

Attribute:
id

Sets ID value to identify the xvcd:xvcd element.

If omitted, the value is not assumed to be specified.

exclude-result-prefixes

Sets namespaces to be excluded from conversion results, of namespaces used in the source XML documents. For values, describe the namespace prefixes of namespaces to exclude, each is separated by a whitespace. If exclude-result-prefixes="#all" is specified, all namespaces within xvcd:xvcd element are excluded.

If omitted, the value is not assumed to be specified.

version (mandatory)

Sets XVCD version number. This must be 1.0.

debug

Sets whether to allow debugging by XVCD Debugger or not. This is a boolean value. If set to true, XVCD Debugger can perform debugging. If set to false, XVCD Debugger cannot perform debugging.

For more information about how to debug XVCD using the XVCD Debugger, see "Debugging XVCD with the XVCD Debugger".

If omitted, false is assumed.

Content:

The elements available in the xvcd:xvcd element are listed below:

2.2. XML Document Structure

Elements and attributes used for representing the structure of the XML document in the namespace for the VC core vocabulary, are listed below.

xvcd:element Element

Used to output a new element to the destination document. Available when changing the outputting element name dynamically during conversion.

Attribute:
name (mandatory)

Sets the name of the element outputting to the destination document. It must be a QName. The attribute value template can be used.

namespace

Sets namespace URI reference for the namespace which defines an outputting element name. It must be an URI reference string. The attribute value template can be used.

If omitted, the value is not assumed to be specified.

use-attribute-sets

Specified when attribute set defined in xvcd:attribute-set element is used. Describe attribute set names QName to use, each separated by a whitespace.

If omitted, attribute set is not used.

Content:

Within the xvcd:element element, the template rule which is specified as the content, if you output the element to the destination document, can be described. However, it is not applied to the xvcd:param element.

xvcd:attribute Element

Used to add a new attribute to the element which is output to the destination document. Available when changing the outputting attribute name dynamically during conversion.

Attribute:
name (mandatory)

Sets the attribute name added to the element outputting to the destination document. It must be a QName. The attribute value template can be used.

namespace

Sets namespace URI reference for the namespace which defines an attribute name. It must be an URI reference string. The attribute value template can be used.

If omitted, the value is not assumed to be specified.

Content:

Within the xvcd:attribute element, template rule which is the attribute's value appended to the element which is output to the destination document can be described. However, it is not applied to the xvcd:param element.

xvcd:attribute-set Element

Defines an attribute set. The attribute set defined in this element is available in the following use-attribute-sets attributes:

Attribute:
name (mandatory)

Define the attribute set name by QName.

use-attribute-sets

Set if attribute set already defined in other xvcd:attribute-set element is used. Describe attribute set names QName to use, each separated by a whitespace.

If omitted, attribute set already defined in other xvcd:attribute-set element is not used.

Content:

The elements available in the xvcd:attribute-set element are listed below:

xvcd:namespace Element

Used to output the namespace node to the destination document. If the namespace prefix you want to output is used for another namespace URI reference for the converted document, an error will occur.

Attribute:
name (mandatory)

Specifies namespace prefix of namespace outputting to the destination document. It must be a NCName. The attribute value template can be used.

select

Specifies namespace URI reference of namespace outputting to the destination document. If output namespace URI reference is described within the xvcd:namespace element, the attribute is not available.

If omitted, the value is not assumed to be specified.

Content:

Within the xvcd:namespace element, namespace URI reference of the namespace outputting to the destination document can be described. If the namespace URI reference is described, the select attribute is not available.

xvcd:namespace-alias Element

Used to change the namespace URI reference used in the XVCD file to another namespace URI reference within the destination document and outputting it.

Attribute:
stylesheet-prefix (mandatory)

Describes the namespace prefix corresponding to a namespace URI reference used in the XVCD file. Set NCName in the namespace prefix. If stylesheet-prefix="#default" is specified, the attribute is intended for the default namespace.

result-prefix (mandatory)

Describe the namespace prefix corresponding to the namespace URI reference when outputting to the destination document. Set NCName in the namespace prefix. If result-prefix="#default" is specified, the default namespace URI reference is used.

Content:

The xvcd:namespace-alias element is empty.

xvcd:processing-instruction Element

Used to output a necessary processing instruction to the destination document.

Attribute:
name (mandatory)

Specifies processing instruction name to output. It must be a NCName. The attribute value template can be used.

Content:

Within the xvcd:processing-instruction element, template rule which is the content of processing instruction which is output to the destination document can be described. However, it is not applied to the xvcd:param element.

xvcd:comment Element

Used to output comment of XML format to the destination document.

Attribute:

No attributes.

Content:

Within the xvcd:comment element, template rule which is the content of the comment which is output to the destination document can be described. However, it is not applied to the xvcd:param element.

2.3. Converting an XML Document

Elements and attributes used for converting the XML document and edit in the namespace for the VC core vocabulary are listed below.

xvcd:vocabulary Element

Associates vocabulary with the sub-tree at the top of which there exists the specific element of DOM tree built from the source XML document. Be sure to use this element in combination with the xvcd:template element described in another location within the XVCD file.

Attribute:
name (mandatory)

Sets the vocabulary name. It must be a QName.

match (mandatory)

Specifies the XPath pattern to identify the apex element of the sub-tree which associates vocabulary.

call-template (mandatory)

Sets named template's name described within the name attribute of xvcd:template element. It must be a QName.

priority

Specifies the order of priority of vocabulary. It must be a number.

If omitted, default priority is set.
Default priority is "1.0" if the XVCD is associated with an XML document by com.xfy vocabulary-connection processing instruction, otherwise it is "0".

Content:

The elements available in the xvcd:vocabulary element are listed below:

The user interface described by the ui:ui element is enabled only if the focus is on the target vocabulary.

xvcd:template Element

Describes the template rule, which converts the node set of the source XML document's DOM tree, within the element.

Attribute:
name

Sets the name used when invoking the template. It must be a QName. If the match attribute is not specified, this attribute needs to be described. The template, whose name attribute is set, is called the named template.

If omitted, the value is not assumed to be specified.

match

Specifies XPath pattern to identify the element to which the template is applied. If the name attribute is not specified, this attribute needs to be described.

If omitted, the value is not assumed to be specified.

mode

Specifies the template rule used when applying the template rule in the xvcd:apply-templates element. It must be a QName. Use this attribute when there are multiple template rules in which the same XPath pattern is specified, and you want to use each rule depending on the situation. If the mode attribute is set for the xvcd:template element, the template rule of the xvcd:template element, whose value matches the value of the mode attribute of the xvcd:apply-templates element, is applied.

If omitted, the value is not assumed to be specified.

priority

Set the priority of template rule.

If omitted, the default priority is assigned.

Content:

Within the xvcd:template element, describe template rule.

xvcd:apply-templates Element

Used to apply another template to child node involved in nodes to which the template rule is applied. Specifies the node set to which another template is applied using the select attribute and mode attribute. If omitted, another template will apply to all child nodes within the node set.

Attribute:
select

Specifies the applied-to node set, in XPath expression,.

If omitted, another template will apply to all child nodes within the node set.

mode

Specifies the mode in which the template rule applies. It must be a QName. The template rule whose attribute matches the mode attribute specified within xvcd:template element is applied.

If omitted, the value is not assumed to be specified.

Content:

The elements available in the xvcd:apply-templates element are listed below:

xvcd:next-match Element

Describes in the template applied within the xvcd:apply-templates element. When multiple template rules can be applied to the node, this element applies the template of which priority is high next to the current template.

Attribute:

No attributes.

Content:

The elements available in the xvcd:next-match element are listed below:

xvcd:filler Element

Describes the template rule which may be applied as fall-back if there is no applicable template rule within the xvcd:apply-templates element and xvcd:text-of element.

Attribute:

No attributes.

Content:

Within the xvcd:filler element, template rule can be described. However, it is not applied to the xvcd:param element.

xvcd:call-template Element

Used to invoke the named template.

Attribute:
name (mandatory)

Specifies the named template's name. It must be a QName. For the named template's name, specify the value described within the name attribute of xvcd:template element.

Content:

The elements available in the xvcd:call-template element are listed below:

xvcd:text Element

Used to output any text string to the destination document. In general, if you describe the string directly in the template rule, it is output to the destination document. The xvcd:text element is available when you want to control the whitespace status which is output to the destination document. Of the xvcd:text element, the string which is output to the destination document cannot be edited in the canvas.

Attribute:
cursor-move-in

Specifies whether the caret can be moved to the text string described within the xvcd:text element. This is a boolean value. If true is specified, you cannot move the caret into the text string. If false is specified, you cannot move the caret into the text string.

If omitted, false is assumed to be set.

Content:

PCDATA string can be described within the xvcd:text element.

xvcd:value-of Element

Used to output the text specified by select attribute to the destination document. The text which is output to the destination document in the xvcd:value-of element is unable to be edited.

Attribute:
select (mandatory)

This attribute sets the XPath expression which represents a string. The result of evaluating XPath expression is converted to text by the same method as string() function, and is output to the destination document.

cursor-move-in

Specifies whether the caret can be moved to the text data described within the xvcd:value-of element. This is a boolean value. If true is specified, you cannot move the caret into the text data. If false is specified, you cannot move the caret within the text data.

If omitted, false is assumed to be set.

Content:

The xvcd:value-of element is empty.

xvcd:copy-of Element

Used to copy the content of source XML document's DOM tree node set and outputting it as is to the destination document. And, this element is also used when copying the XML document fragment returned by command instruction to the destination document as is.

The xvcd:copy-of element copies all types of the nodes contained in the node set specified by select attribute to the destination document without modification. Namespace nodes are also copied. Therefore, the copied result by xvcd:copy-of element may contain some namespace declarations which seem to be unnecessary. This process is necessary to safely copy the node set specified by the select attribute.

Attribute:
select (mandatory)

Specifies the document node set which is copied to the destination document. Specifies XPath expression which identifies the node set.

Content:

The xvcd:copy-of element is empty.

xvcd:copy Element

Used when current node is copied to the destination document. The namespace node of the current node is also automatically copied, but its attributes and child nodes are not copied automatically.

The xvcd:copy element copies the namespace node of the current node to the destination document without modification. Therefore, the copied result by xvcd:copy element may contain some namespace declarations which seem to be unnecessary. This process is necessary to safely copy the contents under the current node.

Attribute:
use-attribute-sets

Specified when attribute set defined in xvcd:attribute-set element is used for copied element. Describe attribute set names QName to use, each separated by a whitespace.

If omitted, attribute set is not used.

Content:

Within the xvcd:copy element, template rule can be described. However, it is not applied to the xvcd:param element.

xvcd:apply-vocabularies Element

If you apply different vocabulary than the one in use to the sub-tree with its tip at specific element of DOM tree built from source XML document, use this element.

Attribute:
select (mandatory)

Specifies the node, in XPath expression, to which another vocabulary is applied.

* If multiple vocabularies are applied to the same node, only first vocabulary is applied.

name

Sets the vocabulary name that has precedence. It must be a QName.

If omitted, a vocabulary may be selected according to the priority set in the system.

Content:

The xvcd:apply-vocabularies element is empty.

xvcd:message Element

Outputs a message to the processor which processes XVCD. The output message is processed by the processor which processes XVCD.

Attribute:

No attributes.

Content:

Within the xvcd:message element, template rule can be described. However, it is not applied to the xvcd:param element. The content described as template rule is, as message, output to the processor which processes XVCD.

xvcd:key Element

Defines the key to be associated with specific node in source XML document. The key associated with the node is available when the node is referred to by using xvcd:key() function.

Attribute:
name (mandatory)

Sets the key name by QName.

match (mandatory)

Set XPath pattern in order to identify the node for setting the key.

use (mandatory)

Sets the XPath expression which represents the key value.
For this XPath expression, the node to associate the key evaluates to a context node. If evaluation is node set, multiple strings to which each node evaluated are associated. If evaluation is other than node set, string that evaluated to single string is associated.

Content:

The xvcd:key element is empty.

xvcd:number Element

Inserts formatted numeric value according to the format into destination document. If value attribute is specified, the numeric value to which its XPath expression evaluated is used. If value attribute is not specified, it is evaluated according to level, count, and from attributes.

Attribute:
level

Sets the level of target source XML document. Specifies one of single, multiple, any:

If omitted, single is assumed.

count

Sets XPath pattern that specifies the node to count.

If omitted, use XPath pattern compliant with all nodes that have the same node type as current node. And, if current node has expanded name, use XPath pattern compliant with all nodes with the same expanded name.

from

Sets XPath pattern that specifies the location to start counting.

If omitted, starts to count from the apex node.

value

Specifies the XPath expression which represents the displayed numeric value.

If omitted, the numeric value is evaluated according to level, count, and from attributes.

format

Specifies the format used when converting from numeric to string. Describe the format in the same format as the format attribute of xsl:number element.

If omitted, "1" is assumed.

Content:

The xvcd:number element is empty.

xvcd:strip-space Element

Defines element set, of elements described in source XML document, that may delete whitespace.

Attribute:
elements (mandatory)

Describe XPath patterns to identify the element that may delete whitespace, each separated by a whitespace.

Content:

The xvcd:strip-space element is empty.

xvcd:preserve-space Element

Defines element set, of elements described in source XML document, that should hold whitespace.

Attribute:
elements (mandatory)

Describe XPath patterns to identify the element that should hold whitespace, each separated by a whitespace.

Content:

The xvcd:preserve-space element is empty.

xvcd:decimal-format Element

Defines a format for the decimal number used in xvcd:format-number() function.

Attribute:
name

Define the format name for decimal number by QName.

If omitted, defines decimal number format used by default.

decimal-separator

Specifies the character used as decimal point symbol.

If omitted, period character (.) is used.

grouping-separator

Specifies the character used for separator symbol for grouping (for example, a thousand unit).

If omitted, comma character (,) is used.

infinity

Specifies the string used to indicate infinity.

If omitted, string "Infinity" is used.

minus-sign

Specifies the character used as minus symbol.

If omitted, hyphen character (-) is used.

NaN

Specifies the string used to indicate NaN type value.

If omitted, string "NaN" is used.

percent

Specifies the character used as percent sign.

If omitted, percent sign (%) is used.

per-mille

Specifies the character used as permille sign.

If omitted, permille sign (#x2030 in Unicode) is used.

zero-digit

Specifies the character used to note zero.

If omitted, zero in Arabic numerals (0) is used.

digit

Specifies the character used for numeric notation involved in format string pattern.

If omitted, number sign (#) is used.

pattern-separator

Specifies the character used to separate plus and minus sub-patterns in format string pattern.

If omitted, semicolon character (;) is used.

Content:

The xvcd:decimal-format element is empty.

2.4. XML Document Edit Operation

In the VC core vocabulary, the following elements and attributes are used to perform an XML document's edit operation:

xvcd:text-of Element

Used to refer to the text node value or attribute node value of source XML document's DOM tree and output it to the destination document as editable text. It differs significantly from the xvcd:value-of element in that the output text is editable.

Attribute:
select (mandatory)

Specifies source XML document's DOM tree node whose value is referred to and is output to the destination document as text. It must be an XPath expression which identifies the node. The source for the text which is output to the destination document may vary according to the node type retrieved by evaluating XPath expression.

  • The retrieved node is a text node
    The node's text data is output to the destination document.
  • Attribute node
    The attribute's value is converted to a text and output to the destination document.
  • Element node
    The operation may vary according to the value specified in position attribute. For more information, see position attribute.

If no referenced text node or attribute node is found, the content of the filler attribute or the content of xvcd:filler element described in xvcd:text-of element may be output to as a substitute string. If nothing is specified in the filler attribute or xvcd:filler element, "???" is output.

position

If the node type retrieved by evaluating XPath expression described within select attribute is element node, this attribute specifies which text node within the element will be relatively referred to, and the retrieved text will be output to the destination document. The text nodes, from which value and data to set are retrieved, are as follows:

first-child
Outputs the text data retrieved from first child text node within the element.
last-child
Outputs the text data retrieved from last child text node within the element.
before
Outputs the text data retrieved from text node just before the element.
after
Outputs the text data retrieved from text node just after the element.

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

mutable

Specifies whether text data which was output to the destination document is editable. It must a boolean value. If true is specified, text data may be editable. And, regardless of the specification in cursor-move-in attribute, you can move the caret into text data. If false is specified, text data may not be editable. If false is specified, the specification in cursor-move-in attribute determines whether you can move the caret into text data. The attribute value template can be used.

If omitted, true is assumed to be set.

cursor-move-in

If false is specified in mutable attribute, this attribute determines whether you can move the caret into text data which was output to the destination document. It must a boolean value. If true is specified, you cannot move the caret into the text data. If false is specified, you cannot move the caret into the text data. If true is specified in mutable attribute, this attribute's value may be ignored.

If omitted, true is assumed to be specified.

type

Specifies simple type of output text data. It must be a QName. The following variable type can be used as a data type:

For more information about the use of auto-correction for constraints on data type, see the extra specifications.

If omitted, it is treated as a normal XML text.

filler

Specifies the string to be displayed when there exists no text data to display. If xvcd:filler element is described within the element, it is unavailable.

If omitted and xvcd:filler element is specified in the element, its content is used. Otherwise, "???" is assumed to be specified.

Content:

The elements available in the xvcd:text-of element are listed below:

xvcd:command Element

Defines a series of command instruction, such as editing of source XML document, operation of UI object. The context node of xvcd:command element will be one of apex elements of source XML document. If you want to refer to the node at caret position, retrieve the node using xvcd:caret-node() function.

The context node of which the command instruction described in the content of xvcd:command element is executed, is the same as the context node of the xvcd:command element.

Attribute:
name (mandatory)

Sets the command name. It must be a QName.
In addition, the multiple xvcd:command element being set to the same command cannot be described in one XVCD file.

checked

Describe XPath expression that indicates command's selection status. The evaluation result of the XPath expression is judged as a boolean value. When the command is registered in the menu, if XPath expression is evaluated to true, the command name is displayed checked in the menu.

If omitted, the value is not assumed to be specified.

enabled

Describe XPath expression whether to allow selecting menu or tool button commands are assigned. The evaluation result of the XPath expression is judged as a boolean value. If the evaluation result of the XPath expression is true, allows the selection.

If omitted, the result whether to be enabled to execute the command instruction describe at the head of xvcd:command element is assumed to be the setting value.

Content:

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

xvcd:action Element

Used to describe command instruction corresponding to User Interface Events performed on the destination document node displayed in canvas.

The context node of which the command instruction described in the content of xvcd:action element is executed, is the same as the context node of the xvcd:action element.

For more information about how to describe the event process using the xvcd:action element, see "Creating Vocabulary Component Responding to User Operations".

Attribute:
event (mandatory)

Describe XPath expression which evaluates User Interface Events represented as XML document fragment. Always evaluated that the event element (event:event) is the current node. The evaluation result of the XPath expression is treated as a boolean value. If XPath expression is evaluated to true, command instruction column described within xvcd:action element is executed.
If you want to refer to the node on which event occurred using XPath expression, use event:target variable.

Content:

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

2.5. Data-Hold

In the VC core vocabulary, elements and attributes used to hold various data processed and the parameter for editing process and so on are below:

xvcd:param Element

Defines the parameter used for a template.

Attribute:
name (mandatory)

Sets the name of a parameter. It must be a QName.

select

Sets XPath expression which indicates initial parameter value. If the template rule is described within the element, the attribute is unavailable.

If omitted, the value is not assumed to be specified.

Content:

Within the xvcd:param element, template rule can be described. However, it is not applied to the xvcd:param element. If the template rule is described, the select attribute is not available.

xvcd:with-param Element

Specifies a parameter value if the template described within the xvcd:apply-templates element and the xvcd:call-template element needs a parameter.

Attribute:
name (mandatory)

Sets the name of a parameter. It must be a QName.

select

Specifies XPath expression which indicates the parameter value.

If omitted, the content of the xvcd:with-param element may be treated as the parameter value.

Content:

Within the xvcd:with-param element, template rule can be described. However, it is not applied to the xvcd:param element. If the template rule is described, the select attribute is not available.

xvcd:variable Element

Describes a variable in XVCD.

Attribute:
name (mandatory)

Sets variable name. It must be a QName.

select

Sets XPath expression which indicates the variable's value. If the template rule is described within the xvcd:variable element, the attribute is unavailable.

If omitted, the value is not assumed to be specified.

Content:

Within the xvcd:variable element, template rule can be described. However, it is not applied to the xvcd:param element. If the template rule is described, the select attribute is not available.

xvcd:user-data Element

Sets data (user data) such as attributes of node without changing the source XML document's DOM tree.

However, in the following case, the setting of the data by this element is invalid.

The Reason Why the Setting of the xvcd:user-data Element is Invalid after the Target User Data is Referred

User data is the function to associate the data which is not described in an XML document with a node in the DOM tree. Therefore, there is no user data in DOM tree immediately after loading XML document.

It is natural to require the setting of the initial value before referring user data. This xvcd:user-data element is provided to satisfy that requirement. That is, the role of the xvcd:user-data element is to initialize the values before the user data is referred.

If the user data is referred before the initial value is set, the referred user data is initialized by an empty string. Therefore, you cannot initialize by the xvcd:user-data element thereafter.

To change the value after the user data is referred, use the xvcd:set-user-data instruction.

Attribute:
name (mandatory)

Sets the name of a user data. It must be a QName.

select

Specifies the node set to which user data is assigned. Sets XPath expression which represents the node set.

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

value (mandatory)

Specifies the user data's initial value. This can be any string. It can also be described in XPath expression, using the attribute value template.

Content:

The xvcd:user-data element is empty.

xvcd:property Element

Describes the information which is not an XML document unit, but is recorded in a system and shared in an archive.

Attribute:
name (mandatory)

Sets the property name. It must be a QName. The property name must described with a namespace prefix.

value (mandatory)

Sets the property's initial value. This can be any string. It can also be described in XPath expression, using the attribute value template.

Content:

The xvcd:property element is empty.

xvcd:resource Element

Describes resource file which associates the xvcd:vocabulary element. For information about the specifications of resource file, see "Resource File Reference".

For more information about how to associate the resource files using the xvcd:resource element, see "Use of Resource File".

Attribute:
src (mandatory)

Describe resource file's URI.

Content:

The xvcd:resource element is empty.

xvcd:resource-text Element

Used to output a resource text string to the destination document. In general, if you describe the string directly in the template rule, it is output to the destination document. Of the xvcd:resource-text element, the string which is output to the destination document cannot be edited in the canvas.

For more information about how to output the resource string using the xvcd:resource-text element, see "Use of Resource File".

Attribute:
key (mandatory)

Describe the key of the resource displayed.

Content:

The xvcd:resource-text element is empty.

2.6. Conditional Branch

Elements and attributes used for the conditional branch process in the VC core vocabulary are listed below.

xvcd:if Element

Used when you want to apply a template rule only if the specified condition is satisfied.

Attribute:
test (mandatory)

Describe an XPath expression as a condition. The evaluation result of the XPath expression is treated as a boolean value. If it returns true, the template rule specified within xvcd:if element is applied.

Content:

Within the xvcd:if element, template rule can be described. However, it is not applied to the xvcd:param element.

xvcd:choose Element

Used when you list multiple conditions and want to apply the template rule which corresponds to the first satisfied condition. Use it in combination with the xvcd:when element or xvcd:otherwise element.

Attribute:

No attributes.

Content:

The elements available in the xvcd:choose element are listed below:

  • xvcd:when element
    At least one element should be described. As many elements as needed can be specified.
  • xvcd:otherwise element
    Only one element can be specified, if needed. Be sure to specify the xvcd:otherwise at the end of the xvcd:choose element if you specify it. Optional.

xvcd:when Element

Used to describe conditions enumerated within the xvcd:choose element and corresponding template rules.

Attribute:
test (mandatory)

Describe an XPath expression as a condition. The evaluation result of the XPath expression is treated as a boolean value. If it returns true, the template rule specified within xvcd:when element is applied.

Content:

Within the xvcd:when element, template rule can be described. However, it is not applied to the xvcd:param element.

xvcd:otherwise Element

Describes the template rule which is applied when all conditions of the xvcd:when elements described in xvcd:choose element will not be satisfied.

Attribute:

No attributes.

Content:

Within the xvcd:otherwise element, template rule can be described. However, it is not applied to the xvcd:param element.

2.7. Repeat

Elements and attributes used for the iterative process in the VC core vocabulary are listed below.

xvcd:for-each Element

Used to iterate the elements in the desired node set included in the source document.

Attribute:
select (mandatory)

Specifies the node set to which reiterative process is applied. Specifies XPath expression which identifies the node set.

Content:

The contents available in the xvcd:for-each element are listed below.

xvcd:sort Element

When outputting the DOM tree node of the source XML document, which complies with the evaluation of the XPath expression specified in the select attribute of xvcd:apply-templates element or the xvcd:for-each element, to the destination document, this element is used to sort processing orders.

Attribute:
select

Specifies the node set to sort. Specifies the XPath expression which returns the node set.

If omitted, "string(.)" is assumed to be specified.

data-type

Specifies whether the node set is sorted by character order or the value converted from string to number. The attribute value template can be used. If it may be sorted by character order, specify text. If it may be sorted by the value converted to number, specify number.

If omitted, text is assumed to be specified.

order

Specifies sort order. The attribute value template can be used. If it may be sorted by ascending order, specify ascending. If it may be sorted by descending order, specify descending.

If omitted, ascending is assumed to be specified.

Content:

The xvcd:sort element is empty.

2.8. Creating a New XML Document

In the VC core vocabulary, the following elements and attributes are used to describe a new XML document's template:

xvcd:document-template Element

Describes a new XML document template within an element, created by using the currently processed XVCD.

For more information about how to create the XML document template using the xvcd:document-template element, see "Creating an XML Document Template with XVCD".

Attribute:
name (mandatory)

Describe new XML document's template name. This should be the ID string. Use the name described within this attribute if you specify an XML document fragment in the new scheme. For more information on new schemes, see "New XML Document Creation Scheme Reference".

save-url

Specifies the default location when a newly created XML document is stored. It must be an URL. It is used for the same purpose as save-url key of new scheme's additional information. When used also with save-url key of new scheme, new scheme takes precedence. For more information on new schemes, see "New XML Document Creation Scheme Reference".

If omitted, the attribute value is not assumed to be set.

target

Sets whether to publish a new XML document template to the other vocabulary. It must be private or common. If set to common, a new XML document template within an element is published. If set to private, it is not published. The published new XML document template can be used from the other vocabulary.

If omitted, private is assumed to be set.

resource-url

Specifies resource file that is associated with new XML document template. It must be an URL. Valid if common is set as target attribute value.

In the resources specified to the new XML document template, the following resources will be used when displaying a list of templates.

Resource Name Description
xfy-name Name of the template.
xfy-description Simple description of the template.
xfy-copyright Copyright information of the template.
xfy-template-category Category of the template.
Categories are expressed in text by separating classes with "/".
The new XML document template will be displayed by using this categorization.

If omitted, the attribute value is not assumed to be set.

Content:

 Within the xvcd:document-template element, a template of the new XML document or a template rule of XVCD can be described.

If new XML document's template is described, the content of xvcd:document-template element is described in XML document embedded format. Therefore, you should to observe the following rule to describe a direct descendent of xvcd:document-template element:

  • Zero or more processing instructions can be described within a direct descendent of xvcd:document-template element.
  • Be sure to describe only one element within a direct descendent of xvcd:document-template element. If no element is described or multiple elements are described, it may not be processed correctly.
  • Any text other than whitespace cannot be described in a direct descendent of xvcd:document-template element.

If a template rule of XVCD is described, the conversion result from the template rule needs to follow the rules mentioned above.

2.9. Importing XVCD from Another File

Elements and attributes to load the XVCD described in another file are shown below:

xvcd:include Element

Imports XVCD described in another file. Unlike xvcd:import element, replaces XVCD's original xvcd:include element with all child elements included in xvcd:xvcd element of XVCD file specified by href attribute.

Attribute:
href (mandatory)

Sets the URI of the XVCD file which you want to import.

Content:

The xvcd:include element is empty.

xvcd:import Element

Imports XVCD described in another file. If the description which operates the same DOM node exists both in the XVCD file to be imported and in the imported XVCD file, the content of the XVCD file to be imported takes precedence. As many elements as needed can be specified at the beginning of the xvcd:xvcd element. Optional.

The following elements are imported from XVCD described in another file:

xvcd:vocabulary element and xvcd:document-template element are not imported.

Attribute:
href (mandatory)

Sets the URI of the XVCD file which you want to import.

Content:

The xvcd:import element is empty.

xvcd:apply-imports Element

Specifies in the template applied in xvcd:apply-templates element. This element applies the XVCD template imported from another file to the node.

Attribute:

No attributes.

Content:

The xvcd:apply-imports element is empty.

2.10. Compatibility with XSLT

The elements provided to maintain compatibility with XSLT are shown below:

xvcd:output Element

The xfy user agent does nothing for this element. Provided for compatibility with XSLT.

Attribute:

No attributes.

Content:

The xvcd:output element is empty.

xvcd:fallback Element

The xfy user agent does nothing for this element. Provided for compatibility with XSLT.

Attribute:

No attributes.

Content:

Within the xvcd:fallback element, template rule can be described. However, it is not applied to the xvcd:param element.

2.11. User-Defined XPath Function

Elements and attributes used to define the user-defined XPath function are shown below.

xvcd:function Element

The elements used to define the user-defined XPath function.

xvcd:function element is a top level element which can be described within the xvcd:xvcd element. In the content, xvcd:expr element or a template rule can be described. If you describe the xvcd:expr element, the function returns the value of evaluation result of the XPath expression described in the xvcd:expr element. If you describe the template rule, the function returns the resultant tree as a node set which evaluated the template rule.

Attribute:
name (mandatory)

Sets XPath function name. It must be a QName. Namespace prefix cannot be omitted in the XPath function. It must be described with a namespace prefix.

Namespace for User-Defined XPath Function

To avoid the conflict with the function defined in the VC core, you should explicitly specify the namespace to which the defined XPath function belongs. For user-defined XPath functions, use the namespace that is the target of the vocabulary component being created, or the namespace that is prepared for user-defined XPath functions.

Content:

The contents available in the xvcd:function element are listed below.

  • xvcd:param element
    Any number of elements can be specified as needed. Optional. Be sure to specify the xvcd:param at the beginning of the xvcd:function element if you specify it. In the xvcd:param element within the xvcd:function element, you cannot describe a select attribute or contents of the element.
  • xvcd:expr element
    Only one element can be specified. Optional. If you describe the xvcd:expr element, the template rule cannot be described.
  • Template rule
    The template rule can be described when the xvcd:expr element is not described.

xvcd:expr Element

Describes the XPath expression which becomes the body of the user-defined XPath function. Available only within the contents of the xvcd:function element.

Attribute:
select (mandatory)

Specifies XPath expression.

Content:

xvcd:expr is an empty element.

2.12. Template Rule

For template rule, XVCD element and literal result element can be described. Describable XVCD elements within the template rule are as follows:

3. Data Type

The following data types are defined in the VC core vocabulary.

xvcd:plain-text Type

Plain text type. Whitespace characters are held. Only available for the xvcd:text-of element.