homexslcompiledtransformw3c.xpathextensions

XPath 2.0 and 3.0 functions for XslCompiledTransform

myxsl.net implements the following XPath 2.0 and 3.0 functions for XslCompiledTransform (which currently supports XPath 1.0 only).

Namespace Bindings

Function Index

fn:abs↑ top

Examples

fn:abs(-5) returns 5

See also

math:acos↑ top

Examples

math:acos(.5) returns 1.0471975511965978

See also

math:asin↑ top

Examples

math:asin(.5) returns 0.5235987755982989

See also

math:atan↑ top

Examples

math:atan(.5) returns 0.4636476090008061

See also

fn:avg↑ top

Examples

<xsl:variable name="numbers-rtf">
  <num>1</num>
  <num>15</num>
  <num>48</num>
</xsl:variable>
<xsl:value-of select="fn:avg(exsl:node-set($numbers-rtf)/*)"/>
returns 21.333333333333332

See also

fn:base-uri↑ top

Examples

fn:base-uri(document('')) returns file:///C:/Data/Sites/net.myxsl/xslcompiledtransform/extensions/w3c.xpath.xsl

See also

fn:compare↑ top

Examples

fn:compare('foo', 'bar') returns 1

See also

math:cos↑ top

Examples

math:cos(.5) returns 0.8775825618903728

See also

fn:current-date↑ top

Examples

fn:current-date() returns 2013-05-21-04:00

See also

fn:current-dateTime↑ top

Examples

fn:current-dateTime() returns 2013-05-21T13:09:54.54-04:00

See also

fn:current-time↑ top

Examples

fn:current-time() returns 13:09:54.54-04:00

See also

fn:data↑ top

Examples

<xsl:variable name="schema-rtf">
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="a" type="xs:integer"/>
  </xs:schema>
</xsl:variable>
<xsl:variable name="doc-rtf">
  <a>5</a>
</xsl:variable>
<xsl:variable name="validated-doc" select="ext:validate(exsl:node-set($doc-rtf), exsl:node-set($schema-rtf))"/>
<xsl:value-of select="exsl:object-type(fn:data($validated-doc/a))"/>
returns number

See also

fn:deep-equal↑ top

Examples

<xsl:variable name="attendees-rtf">
  <name last="Parker" first="Peter"/>
  <name last="Barker" first="Bob"/>
  <name last="Parker" first="Peter"/>
</xsl:variable>
<xsl:variable name="attendees" select="exsl:node-set($attendees-rtf)"/>
<xsl:value-of select="fn:deep-equal($attendees/name[1], $attendees/name[3])"/>
returns true

See also

fn:distinct-values↑ top

Examples

<xsl:variable name="numbers-rtf">
  <num>2</num>
  <num>2</num>
  <num>5</num>
</xsl:variable>
<xsl:value-of select="fn:string-join(fn:distinct-values(exsl:node-set($numbers-rtf)/*), ', ')"/>
returns 2, 5

See also

fn:document-uri↑ top

Examples

fn:document-uri(document('')) returns file:///C:/Data/Sites/net.myxsl/xslcompiledtransform/extensions/w3c.xpath.xsl

See also

fn:empty↑ top

Examples

fn:empty(document('')/foo) returns true

See also

fn:encode-for-uri↑ top

Examples

fn:encode-for-uri('100% organic') returns 100%25%20organic

See also

fn:ends-with↑ top

Examples

fn:ends-with('hello', 'lo') returns true

See also

fn:error↑ top

See also

fn:exactly-one↑ top

Examples

fn:exactly-one(document('')/*/@version) returns 1.0

See also

fn:exists↑ top

Examples

fn:exists(document('')/foo) returns false

See also

math:exp↑ top

Examples

math:exp(2) returns 7.38905609893065

See also

math:exp10↑ top

Examples

math:exp10(.5) returns 3.1622776601683795

See also

fn:has-children↑ top

Examples

fn:has-children(document('')) returns true

See also

fn:head↑ top

Examples

fn:head(document('')/*/@*) returns 1.0

See also

fn:in-scope-prefixes↑ top

Examples

fn:string-join(fn:in-scope-prefixes(document('')/*), ', ') returns xml, exsl, xsl, , xs, xsi, fn, math, ext, msxsl, app

See also

math:log↑ top

Examples

math:log(2) returns 0.6931471805599453

See also

math:log10↑ top

Examples

math:log10(2) returns 0.3010299956639812

See also

fn:lower-case↑ top

Examples

fn:lower-case('ABc!D') returns abc!d

See also

fn:matches↑ top

Examples

fn:matches('abracadabra', 'BRA', 'i') returns true

See also

fn:max↑ top

Examples

<xsl:variable name="numbers-rtf">
  <num>1</num>
  <num>15</num>
  <num>48</num>
</xsl:variable>
<xsl:value-of select="fn:max(exsl:node-set($numbers-rtf)/*)"/>
returns 48

See also

fn:min↑ top

Examples

<xsl:variable name="numbers-rtf">
  <num>1</num>
  <num>15</num>
  <num>48</num>
</xsl:variable>
<xsl:value-of select="fn:min(exsl:node-set($numbers-rtf)/*)"/>
returns 1

See also

fn:namespace-uri-for-prefix↑ top

Examples

fn:namespace-uri-for-prefix('xsl', document('')/*) returns http://www.w3.org/1999/XSL/Transform

See also

fn:nilled↑ top

Examples

<xsl:variable name="schema-rtf">
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="a" nillable="true"/>
  </xs:schema>
</xsl:variable>
<xsl:variable name="doc-rtf">
  <a xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</xsl:variable>
<xsl:variable name="validated-doc" select="ext:validate(exsl:node-set($doc-rtf), exsl:node-set($schema-rtf))"/>
<xsl:value-of select="fn:nilled($validated-doc/a)"/>
returns true

See also

fn:one-or-more↑ top

Examples

fn:string-join(fn:one-or-more(document('')/*/@*), ', ') returns 1.0, exsl fn xs xsi math msxsl app ext

See also

fn:parse-xml↑ top

Examples

count(fn:parse-xml('<a><b/><b/></a>')/a/b) returns 2

See also

fn:parse-xml-fragment↑ top

Examples

count(fn:parse-xml-fragment('<b/><b/>')/b) returns 2

See also

fn:path↑ top

Examples

fn:path(document('')/*/@version) returns /"http://www.w3.org/1999/XSL/Transform":stylesheet[1]/@version

See also

math:pi↑ top

Examples

math:pi() returns 3.141592653589793

See also

math:pow↑ top

Examples

math:pow(2, 3) returns 8

See also

fn:replace↑ top

Examples

fn:replace('abracadabra', 'bra', '*') returns a*cada*

See also

fn:resolve-uri↑ top

Examples

fn:resolve-uri('/foo', 'http://example.com/bar') returns http://example.com/foo

See also

fn:root↑ top

Examples

<xsl:variable name="numbers-rtf">
  <num>1</num>
  <num>15</num>
  <num>48</num>
</xsl:variable>
<xsl:value-of select="fn:root(exsl:node-set($numbers-rtf)/*[1])"/>
returns 11548

See also

fn:round-half-to-even↑ top

Examples

fn:round-half-to-even(-2.5) returns -2

See also

fn:serialize↑ top

Examples

<xsl:variable name="items-rtf">
  <a>1</a>
  <xsl:text>text</xsl:text>
  <b>2</b>
</xsl:variable>
<xsl:variable name="serialization-parameters-rtf">
  <output:serialization-parameters xmlns:output="http://www.w3.org/2010/xslt-xquery-serialization">
    <output:method value="text"/>
  </output:serialization-parameters>
</xsl:variable>
<xsl:value-of select="fn:serialize(exsl:node-set($items-rtf)/node(), exsl:node-set($serialization-parameters-rtf))"/>
returns 1text2

See also

math:sin↑ top

Examples

math:sin(.5) returns 0.479425538604203

See also

math:sqrt↑ top

Examples

math:sqrt(9) returns 3

See also

fn:static-base-uri↑ top

Examples

fn:static-base-uri() returns file:///C:/Data/Sites/net.myxsl/xslcompiledtransform/extensions/w3c.xpath.xsl

See also

fn:string-join↑ top

Examples

fn:string-join(document('')/*/@*, ', ') returns 1.0, exsl fn xs xsi math msxsl app ext

See also

fn:subsequence↑ top

Examples

<xsl:variable name="numbers-rtf">
  <num>1</num>
  <num>15</num>
  <num>48</num>
</xsl:variable>
<xsl:value-of select="fn:subsequence(exsl:node-set($numbers-rtf)/*, 2, 1)"/>
returns 48

See also

fn:tail↑ top

Examples

fn:tail(document('')/*/@*) returns exsl fn xs xsi math msxsl app ext

See also

math:tan↑ top

Examples

math:tan(.5) returns 0.5463024898437905

See also

fn:tokenize↑ top

Examples

fn:string-join(fn:tokenize('2006-12-25T12:15:00', '[\-T:]'), ', ') returns 2006, 25, 00, 12, 15, 12

See also

fn:trace↑ top

Examples

fn:trace('test', '') returns test

See also

fn:upper-case↑ top

Examples

fn:upper-case('abcd') returns ABCD

See also

fn:zero-or-one↑ top

Examples

fn:zero-or-one(document('')/*/@version) returns 1.0

See also

See Also

About this page