Chapter 8. Using the XSLT and XPath Functions

Chapter 8. Using the XSLT and XPath Functions

graphics/chic01.gif

This chapter explores the functions available to you in XSLT, both the built-in XSLT functions and the XPath functions you can use. Youve already seen a number of these functions, such as id , generate-id , position , count , and so on. In this chapter, youll see all the available functions.

Some of the functions available are built into XSLT, and some from within XPath. Both XSLT and XPath are in the process of being upgraded to version 2.0, and at the end of this chapter Ill take a look at the future and what new functions will be appearing. (No new version 2.0 functions have been made public yet.)

The following functions are built into XSLT:

  • element-available()

  • function-available()

  • current()

  • document()

  • key()

  • format-number()

  • generate-id()

  • system-property ()

  • unparsed-entity-uri ()

There are many functions from XPath that are also available to you. Ill organize these functions by the XPath data type on which they work. There are four such data types: node sets, strings, numbers , and Booleans. Here are the XPath functions that work on node sets:

  • count()

  • id()

  • last()

  • local- name ()

  • name()

  • namespace-uri()

  • position()

These are the XPath functions that work on strings:

  • concat()

  • contains()

  • normalize-space()

  • starts-with ()

  • string()

  • string-length ()

  • substring ()

  • substring-after()

  • substring-before ()

  • translate()

These XPath functions work on numbers:

  • ceiling()

  • floor()

  • number()

  • round()

  • sum()

And these XPath functions work with Boolean values:

  • boolean()

  • false()

  • lang()

  • not()

  • true()

Youll see all these functions at work in this chapter, starting with the functions that are built into XSLT. This is not necessarily a chapter to read straight through, but rather to keep in mind as a referenceall the functions are here, ready to look up and put to work.



Inside XSLT
Inside Xslt
ISBN: B0031W8M4K
EAN: N/A
Year: 2005
Pages: 196

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net