net.sf.saxon.functions

Class NormalizeSpace

public class NormalizeSpace extends SystemFunction

Implement the XPath normalize-space() function
Method Summary
ItemevaluateItem(XPathContext c)
Evaluate in a general context
intgetIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions.
static CharSequencenormalize(CharSequence s)
The algorithm that does the work: it removes leading and trailing whitespace, and replaces internal whitespace by a single space character.
ExpressionpreEvaluate(StaticContext env)
Pre-evaluate a function at compile time.
Expressionsimplify(StaticContext env)
Simplify and validate.

Method Detail

evaluateItem

public Item evaluateItem(XPathContext c)
Evaluate in a general context

getIntrinsicDependencies

public int getIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions. For example, position() has an intrinsic dependency on the context position, while (position()+1) does not. The default implementation of the method returns 0, indicating "no dependencies".

Returns: a set of bit-significant flags identifying the "intrinsic" dependencies. The flags are documented in class net.sf.saxon.value.StaticProperty

normalize

public static CharSequence normalize(CharSequence s)
The algorithm that does the work: it removes leading and trailing whitespace, and replaces internal whitespace by a single space character. The code is optimized for two special cases: where the string is all whitespace, and where it contains no spaces at all (including the case where it is empty). In these two cases it avoids creating a new object.

preEvaluate

public Expression preEvaluate(StaticContext env)
Pre-evaluate a function at compile time. Functions that do not allow pre-evaluation, or that need access to context information, can override this method.

simplify

public Expression simplify(StaticContext env)
Simplify and validate.