Chapter 11

XPath Data Types and Functions

In This Chapter

bullet Nodeset functions

bullet String functions

bullet Number functions

bullet Boolean functions

bullet General purpose XSLT functions

T he very first words I could read as a child were free inside.

Everyone likes to get something for free, and with XSLT, you get a host of built-in functions for free inside XPath and XSLT. These functions give you a power boost that you can use when you create stylesheets.

Most of the built-in functions are categorized by the kind of data that they work with. The four primary data types in XSLT are: node sets, strings, numbers, and booleans. In this chapter, you find out all about the major built-in functions for these data types and about some general-purpose functions.

Throughout the chapter, I refer to the following menu.xml source document in Listing 11-1 to demonstrate the use of built-in functions.

Listing 11-1: menu.xml

<?xml version=”1.0”?>

<menu>

  <entree name=”Sunburnt Chicken”>

    <diet>false</diet> ...

Get XSLT for Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.