XPath

XPath Intro
XPath Nodes
XPath Syntax
XPath Axes
XPath Operators
XPath Examples
XPath Summary
(Source w3c)
Working with numbers
ceiling() Generates the smallest integer that is not less than the number passed to the function
floor() Generates the largest integer that is not less than the number passed to the function
number() The value passed to the function is converted to a number.
round() The number passed to the function is rounded to the nearest integer.
sum() A total value is calculated from the set of numeric values (node set) passed to it.
Working with text
concat(str1, str2,…) Concentrates two string values
contains() Returns a Boolean value indicating whether the first value contains the second (true), or not (false)
normalize-space() Leading and trailing spaces are removed from the value
starts-with() Returns a Boolean value indicating whether the first value begins with the second value passed in
string() Converts a value to a string
string-length()
substring(str, begin, end)
Sample code:
<xsl:value-of select=”sum(//books/book/price)”/>
<xsl:variable name=”title” select=”//books/book/title”/>
<xsl:if test=”contains($title,’Shrug’)”>
<xsl:value-of select=”$title”/>