The Official XMLSPY Handbook

In this chapter and in Chapter 6, I have used XPath functions such as position without much explanation. In XPath there are a number of functions that perform specific operations. When writing XPath, you need to know what the functions are and what they can do. The XPath functions can be broken into the following groups: node-set, string, Boolean, number, and XSLT-defined functions. These functions are discussed in the following sections.

XSLT data types and conversion

XML works because XML is based on text that can be either eight bit or Unicode. But in either case, it is still text. Text is a better approach because you don’t have to worry about computer translation errors. Not all operations in XSLT, however, are based on text. XSLT includes five different data types:

Depending on the function or context, XSLT automatically converts a data from one type to another.

Node-set functions

The node-set functions enable you to know what node-set is being managed. This is important when using repetitive XSLT instructions. The following list provides the instructions that you can use to figure out the properties of a node-set:

String functions

The following string functions enable you to manipulate strings by extracting substrings or building new strings:

Boolean functions

The following Boolean functions enable you to manipulate Boolean values.

Number functions

The following number functions enable you to manipulate numbers and figure out what a number represents:

Additional XSLT functions

The additional XSLT functions are functions that are not part of the XPath specification but are part of the XSLT specification. Typically, these functions are very specific to XSLT and are shown in the following list:

Категории