XSL (eXtensible Style Sheets) Methods


XSL contains a set of methods for counting and formatting tasks. The methods are implemented inside the xsl:eval and xsl:script tags.

XSL Built-in Methods

ElementParametersDescription
absoluteChildNumber Node object. Returns node number relative to all child nodes.
ancestorChildNumber Ancestor node name, node object. Returns number of nearest ancestor of node with specified node name.
childNumber Node object. Returns number of node relative to children of the same node name.
depth Node object. Returns depth within the XML document tree at which the specified node appears.
formatDate Date, format (m-mmmmm/d-dddd/yy-yyyy), locale (country) date sequence. Date formatting.
formatIndex Long integer, format (1, 01, A, a, I, i). Integer formatting.
formatNumber Double number, format (#, 0, ?, ., , %, E-, E+). Number formatting.
formatTime Time, format (h-hh, m-mm, s-ss, AM/PM, am/pm, A/P, [h]:mm, [mm]:ss, [ss], ss.00), country locale ordering format. Time formatting.
uniqueID Node object. Returns a unique identifier for the node. This identifier is global accross the XML data tree object. Therefore if the uniqueID could be used to find data objects in the XML data tree it would be very useful indeed.

XMLDOM built-in methods are executed within the xsl:eval tags as shown below.

<xsl:for-each select="customer">
	The uniqueID of <xsl:value-of select=""/> is <xsl:eval>uniqueID(this))</xsl:eval>
	<xsl:apply-templates />
</xsl:for-each>