APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xalan.internal.lib

public Class ExsltMath

extends ExsltBase
Class Inheritance
Imports
com.sun.org.apache.xpath.internal.NodeSet, org.w3c.dom.Node, .NodeList

This class contains EXSLT math extension functions. It is accessed by specifying a namespace URI as follows:
   xmlns:math="http://exslt.org/math"
The documentation for each function has been copied from the relevant EXSLT Implementer page.
See Also
EXSLT

Field Summary

Modifier and TypeField and Description
private static String
E

private static String
private static String
private static String
private static String
private static String
private static String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static double

Returns:

The absolute value of the number
abs
(double
A number
num
)

The math:abs function returns the absolute value of a number.

public static double

Returns:

The arccosine value of the number
acos
(double
A number
num
)

The math:acos function returns the arccosine value of a number.

public static double

Returns:

The arcsine value of the number
asin
(double
A number
num
)

The math:asin function returns the arcsine value of a number.

public static double

Returns:

The arctangent value of the number
atan
(double
A number
num
)

The math:atan function returns the arctangent value of a number.

public static double

Returns:

The angle (in radians) from the X axis to a point (y,x)
atan2
(double
The X axis value
num1
,
double
The Y axis value
num2
)

The math:atan2 function returns the angle ( in radians ) from the X axis to a point (y,x).

public static double

Returns:

The value of the specified constant to the given precision
constant
(String
The name of the constant
name
,
double
The precision
precision
)

The math:constant function returns the specified constant to a set precision.

public static double

Returns:

The cosine value of the number
cos
(double
A number
num
)

The math:cos function returns cosine of the passed argument.

public static double

Returns:

The value of e raised to the given power
exp
(double
A number
num
)

The math:exp function returns e (the base of natural logarithms) raised to a power.

public static NodeList

Returns:

node-set with nodes containing the maximum value found, an empty node-set if any node cannot be converted to a number.
highest
(NodeList
The NodeList for the node-set to be evaluated.
nl
)

The math:highest function returns the nodes in the node set whose value is the maximum value for the node set.

public static double

Returns:

The natural logarithm of the number
log
(double
A number
num
)

The math:log function returns the natural logarithm of a number.

public static NodeList

Returns:

node-set with nodes containing the minimum value found, an empty node-set if any node cannot be converted to a number.
lowest
(NodeList
The NodeList for the node-set to be evaluated.
nl
)

The math:lowest function returns the nodes in the node set whose value is the minimum value for the node set.

public static double

Returns:

the maximum value found, NaN if any node cannot be converted to a number.
max
(NodeList
The NodeList for the node-set to be evaluated.
nl
)

The math:max function returns the maximum value of the nodes passed as the argument.

public static double

Returns:

the minimum value found, NaN if any node cannot be converted to a number.
min
(NodeList
The NodeList for the node-set to be evaluated.
nl
)

The math:min function returns the minimum value of the nodes passed as the argument.

public static double

Returns:

The value of the base expression taken to the specified power
power
(double
The base
num1
,
double
The power
num2
)

The math:power function returns the value of a base expression taken to a specified power.

public static double

Returns:

A random double from 0 to 1
random
()

The math:random function returns a random number from 0 to 1.

public static double

Returns:

The sine value of the number
sin
(double
A number
num
)

The math:sin function returns the sine of the number.

public static double

Returns:

The square root of the number
sqrt
(double
A number
num
)

The math:sqrt function returns the square root of a number.

public static double

Returns:

The tangent value of the number
tan
(double
A number
num
)

The math:tan function returns the tangent of the number passed as an argument.

Inherited from com.sun.org.apache.xalan.internal.lib.ExsltBase:
toNumbertoString

Field Detail

Eback to summary
private static String E
LN10back to summary
private static String LN10
LN2back to summary
private static String LN2
LOG2Eback to summary
private static String LOG2E
PIback to summary
private static String PI
SQRRT2back to summary
private static String SQRRT2
SQRT1_2back to summary
private static String SQRT1_2

Constructor Detail

ExsltMathback to summary
public ExsltMath()

Method Detail

absback to summary
public static double abs(double num)

The math:abs function returns the absolute value of a number.

Parameters
num:double

A number

Returns:double

The absolute value of the number

acosback to summary
public static double acos(double num)

The math:acos function returns the arccosine value of a number.

Parameters
num:double

A number

Returns:double

The arccosine value of the number

asinback to summary
public static double asin(double num)

The math:asin function returns the arcsine value of a number.

Parameters
num:double

A number

Returns:double

The arcsine value of the number

atanback to summary
public static double atan(double num)

The math:atan function returns the arctangent value of a number.

Parameters
num:double

A number

Returns:double

The arctangent value of the number

atan2back to summary
public static double atan2(double num1, double num2)

The math:atan2 function returns the angle ( in radians ) from the X axis to a point (y,x).

Parameters
num1:double

The X axis value

num2:double

The Y axis value

Returns:double

The angle (in radians) from the X axis to a point (y,x)

constantback to summary
public static double constant(String name, double precision)

The math:constant function returns the specified constant to a set precision. The possible constants are:

 PI
 E
 SQRRT2
 LN2
 LN10
 LOG2E
 SQRT1_2
Parameters
name:String

The name of the constant

precision:double

The precision

Returns:double

The value of the specified constant to the given precision

cosback to summary
public static double cos(double num)

The math:cos function returns cosine of the passed argument.

Parameters
num:double

A number

Returns:double

The cosine value of the number

expback to summary
public static double exp(double num)

The math:exp function returns e (the base of natural logarithms) raised to a power.

Parameters
num:double

A number

Returns:double

The value of e raised to the given power

highestback to summary
public static NodeList highest(NodeList nl)

The math:highest function returns the nodes in the node set whose value is the maximum value for the node set. The maximum value for the node set is the same as the value as calculated by math:max. A node has this maximum value if the result of converting its string value to a number as if by the number function is equal to the maximum value, where the equality comparison is defined as a numerical comparison using the = operator.

If any of the nodes in the node set has a non-numeric value, the math:max function will return NaN. The definition numeric comparisons entails that NaN != NaN. Therefore if any of the nodes in the node set has a non-numeric value, math:highest will return an empty node set.

Parameters
nl:NodeList

The NodeList for the node-set to be evaluated.

Returns:NodeList

node-set with nodes containing the maximum value found, an empty node-set if any node cannot be converted to a number.

logback to summary
public static double log(double num)

The math:log function returns the natural logarithm of a number.

Parameters
num:double

A number

Returns:double

The natural logarithm of the number

lowestback to summary
public static NodeList lowest(NodeList nl)

The math:lowest function returns the nodes in the node set whose value is the minimum value for the node set. The minimum value for the node set is the same as the value as calculated by math:min. A node has this minimum value if the result of converting its string value to a number as if by the number function is equal to the minimum value, where the equality comparison is defined as a numerical comparison using the = operator.

If any of the nodes in the node set has a non-numeric value, the math:min function will return NaN. The definition numeric comparisons entails that NaN != NaN. Therefore if any of the nodes in the node set has a non-numeric value, math:lowest will return an empty node set.

Parameters
nl:NodeList

The NodeList for the node-set to be evaluated.

Returns:NodeList

node-set with nodes containing the minimum value found, an empty node-set if any node cannot be converted to a number.

maxback to summary
public static double max(NodeList nl)

The math:max function returns the maximum value of the nodes passed as the argument. The maximum value is defined as follows. The node set passed as an argument is sorted in descending order as it would be by xsl:sort with a data type of number. The maximum is the result of converting the string value of the first node in this sorted list to a number using the number function.

If the node set is empty, or if the result of converting the string values of any of the nodes to a number is NaN, then NaN is returned.

Parameters
nl:NodeList

The NodeList for the node-set to be evaluated.

Returns:double

the maximum value found, NaN if any node cannot be converted to a number.

See Also
EXSLT
minback to summary
public static double min(NodeList nl)

The math:min function returns the minimum value of the nodes passed as the argument. The minimum value is defined as follows. The node set passed as an argument is sorted in ascending order as it would be by xsl:sort with a data type of number. The minimum is the result of converting the string value of the first node in this sorted list to a number using the number function.

If the node set is empty, or if the result of converting the string values of any of the nodes to a number is NaN, then NaN is returned.

Parameters
nl:NodeList

The NodeList for the node-set to be evaluated.

Returns:double

the minimum value found, NaN if any node cannot be converted to a number.

See Also
EXSLT
powerback to summary
public static double power(double num1, double num2)

The math:power function returns the value of a base expression taken to a specified power.

Parameters
num1:double

The base

num2:double

The power

Returns:double

The value of the base expression taken to the specified power

randomback to summary
public static double random()

The math:random function returns a random number from 0 to 1.

Returns:double

A random double from 0 to 1

sinback to summary
public static double sin(double num)

The math:sin function returns the sine of the number.

Parameters
num:double

A number

Returns:double

The sine value of the number

sqrtback to summary
public static double sqrt(double num)

The math:sqrt function returns the square root of a number.

Parameters
num:double

A number

Returns:double

The square root of the number

tanback to summary
public static double tan(double num)

The math:tan function returns the tangent of the number passed as an argument.

Parameters
num:double

A number

Returns:double

The tangent value of the number