Card Puncher Data Processing


XQuery 1.0, XPath 2.0, and XSLT 2.0 share the same functions library.

Xpath Functions return a string, a number, or a Boolean value.

For example, the expression /PROJECT/text() gets the string-value of PROJECT nodes.

Many functions depend on the current context. In the preceding example, the context for each invocation of the text() function is the PROJECT node that is currently selected.

For more information about functions, see section 4 of the XPath specification.



These functions let you determine the namespace characteristics of a node.

  • local-name(): Returns the name of the current node, minus the namespace prefix. Ie the element name (9/10 what we need). For example, /*[local-name()!='HEAD'] selects all elements excepted the HEAD elements.
  • local-name(…): Returns the name of the first node in the specified node set, minus the namespace prefix.
  • namespace-uri(): Returns the namespace URI from the current node.
  • namespace-uri(…): Returns the namespace URI from the first node in the specified node-set.
  • name(): Returns the expanded name (URI plus local name) of the current node.
  • name(…): Returns the expanded name (URI plus local name) of the first node in the specified node-set.


Many XPath expressions select a set of nodes. In essence, they return a node-set.

The id(…) function returns the node with the specified ID (

not the position (ie index)



These functions return positionally based numeric values.

  • last(): Returns the index of the last element. For example, /HEAD[last()] selects the last HEAD element.
  • position(): Returns the index position. For example, /HEAD[position() ⇐ 5] selects the first five HEAD elements.
  • count(…): Returns the count of elements. For example, /HEAD[count(HEAD)=0] selects all HEAD elements that have no subheads.


These functions operate on or return strings.

  • concat(string, string, …): Concatenates the string values.
  • starts-with(string1, string2): Returns true if string1 starts with string2.
  • contains(string1, string2): Returns true if string1 contains string2.
  • substring-before(string1, string2): Returns the start of string1 before string2 occurs in it.
  • substring-after(string1, string2): Returns the remainder of string1 after string2 occurs in it.
  • substring(string, idx): Returns the substring from the index position to the end, where the index of the first char = 1.
  • substring(string, idx, len): Returns the substring of the specified length from the index position.
  • string-length(): Returns the size of the context node's string-value; the context node is the currently selected node-the node that was selected by an XPath expression in which a function such as string-length() is applied.
  • string-length(string): Returns the size of the specified string.
  • normalize-space(): Returns the normalized string-value of the current node (no leading or trailing white space, and sequences of white space characters converted to a single space).
  • normalize-space(string): Returns the normalized string-value of the specified string.
  • translate(string1, string2, string3): Converts string1, replacing occurrences of characters in string2 with the corresponding character from string3.

Note - XPath defines three ways to get the text of an element:

  • text(),
  • string(object),
  • and the string-value implied by an element name in an expression like this: /PROJECT[PERSON=“Fred”].


These functions operate on or return Boolean values.

  • not(…): Negates the specified Boolean value.
  • true(): Returns true.
  • false(): Returns false.
  • lang(string): Returns true if the language of the context node (specified by xml:Lang attributes) is the same as (or a sub-language of) the specified language; for example, Lang(“en”) is true for …



These functions operate on or return numeric values.

  • sum(…): Returns the sum of the numeric value of each node in the specified node-set.
  • floor(N): Returns the largest integer that is not greater than N.
  • ceiling(N): Returns the smallest integer that is not less than N.
  • round(N): Returns the integer that is closest to N.


These functions convert one data type to another.

  • string(…): Returns the string value of a number, Boolean, or node-set.
  • boolean(…): Returns a Boolean value for a number, string, or node-set (a non-zero number, a non-empty node-set, and a non-empty string are all true).
  • number(…): Returns the numeric value of a Boolean, string, or node-set (true is 1, false is 0, a string containing a number becomes that number, the string-value of a node-set is converted to a number).

Discover More
Card Puncher Data Processing
XSLT - Data Type

XSLT - Data Type Xalan Conversions from XSLT to Java XSLT type Java types (in decreasing order of preference) node-set org.w3c.dom.traversal.NodeIterator, org.w3c.dom.NodeList, org.w3c.dom.Node,...
Card Puncher Data Processing
XSLT - Java Transformation (Call|Extension)

How to call java method from an Xsl stylesheet processor XSLT is not an object oriented language. Static methods fit much more neatly into its structures than do objects and instance methods. ...
Card Puncher Data Processing
XSLT - Templates

an some other tag, or whitespace. HTML outputs the HTML start tags, processes any templates that apply to children of the root, and then outputs the HTML end tags.
Card Puncher Data Processing
XSLT/XPATH - Special Character

Curly braces cause the text inside the quotes to be processed as an XPath expression instead of being interpreted as a literal string. Curly braces are recognized anywhere that an attribute value template...
Card Puncher Data Processing

Single quotes are required to determine a a string. With double quote, the XSLT processor attempts to interpret the word as an XPath function. See the following function:
Card Puncher Data Processing
Xml - Xpath

XPath is a pattern expression used to select a set of XML nodes. You can select: from node name from attributes from text In the XPath specification, the document model defines seven kinds of...

Share this page:
Follow us:
Task Runner