1 Introducti*on
2 XQuery and* XPath Fun*ctions
3 XSL Transf*ormations *(XSLT) Fun*ctions
4 XML Schema*
5 Normative *References*
6 Non-Normat*ive Refere*nces
This docum*ent descri*bes the na*mespace
http://www*.w3.org/20*05/xpath-f*unctions
defined b*y the
[XPath and *XQuery Fun*ctions and* Operators* 3.1] and [XSLT 3.0]
specifica*tions (Oct*ober 2014 *and
Decemb*er 2013 ve*rsions, re*spectively*).
This na*mespace is* identifie*d by the n*amespace p*refix fn:
,
which is* a predefi*ned prefix*.
For upd*ated infor*mation, pl*ease refer* to the la*test versi*on of the
*[XPath and *XQuery Fun*ctions and* Operators* 3.1] and [XSLT 3.0]
specifica*tions.
This docu*ment descr*ibes the n*ames that *are define*d in this *namespace *at the tim*e of publi*cation. Th*e W3C rese*rves the r*ight to de*fine addit*ional name*s in this *namespace *in the fut*ure. [XPath and *XQuery Fun*ctions and* Operators* 3.1] and [XSLT 3.0] are the only specifica*tions that* may amend* this name*space.
This docu*ment conta*ins a dire*ctory of l*inks to re*lated reso*urces, usi*ng RDDL (a*s defined *in [Resource D*irectory D*escription* Language *(RDDL)]).
It is GRD*DL-enabled* (as defin*ed in [Gleaning R*esource De*scriptions* from Dial*ects of La*nguages (G*RDDL)]); that is* to say th*at a GRDDL*-compliant* processor* can extra*ct useful *RDF (as de*fined in [Resource D*escription* Framework* (RDF): Co*ncepts and* Abstract *Syntax]) represen*tations of* the infor*mation con*tained her*ein.
This secti*on lists a*ll of the *functions *defined in* the
[XPath and *XQuery Fun*ctions and* Operators* 3.1] specifica*tion. Each*
function *and operat*or is uniq*uely ident*ified with* a URI of *the form:
*“http://www*.w3.org/20*05/xpath-f*unctions#
name”
where name is the na*me of a fu*nction or *operator, *such as
“m*ax”: http://www*.w3.org/20*05/xpath-f*unctions#m*ax
.
The normat*ive defini*tions of t*hese funct*ions are i*n the [XPath and *XQuery Fun*ctions and* Operators* 3.1] specifica*tion. For *convenienc*e, a very *brief, non*-normative* summary o*f each fun*ction is p*rovided. F*or details*, follow t*he link on* the “Summ*ary:” intr*oductory t*ext below *each funct*ion.
xs:numeric*? abs(xs:numeric*?)
Returns th*e absolute* value of *$arg
.
xs:dateTim*e? adjust-dat*eTime-to-t*imezone(xs:dateTim*e?)
xs:dateTim*e? adjust-dat*eTime-to-t*imezone(xs:dateTim*e?, xs:dayTime*Duration?)
Adjusts an* xs:dateTim*e
value to *a specific* timezone,* or to no *timezone a*t
* all.
xs:date? adjust-dat*e-to-timez*one(xs:date?)
xs:date? adjust-dat*e-to-timez*one(xs:date?, xs:dayTime*Duration?)
Adjusts an* xs:date
value to *a specific* timezone,* or to no *timezone a*t all;
* t*he result *is the dat*e in the t*arget time*zone that *contains t*he startin*g instant *of the
* s*upplied da*te.
xs:time? adjust-tim*e-to-timez*one(xs:time?)
xs:time? adjust-tim*e-to-timez*one(xs:time?, xs:dayTime*Duration?)
Adjusts an* xs:time
value to *a specific* timezone,* or to no *timezone a*t
* all.
element(fn*:analyze-s*tring-resu*lt) analyze-st*ring(xs:string?*, xs:string)
element(fn*:analyze-s*tring-resu*lt) analyze-st*ring(xs:string?*, xs:string, xs:string)
Analyzes a* string us*ing a regu*lar expres*sion, retu*rning an X*ML structu*re that id*entifies * * which par*ts of the *input stri*ng matched* or failed* to match *the regula*r expressi*on, and * *in the cas*e of match*ed substri*ngs, which* substring*s matched *each captu*ring group* in the * *regular ex*pression.
array(*) append(array(*), item()*)
Adds one m*ember at t*he end of *an array, *creating a* new array*.
xs:string** available-*environmen*t-variable*s()
Returns a *list of en*vironment *variable n*ames that *are suitab*le for pas*sing to
* * fn:environ*ment-varia*ble
, as a (po*ssibly emp*ty) sequen*ce of stri*ngs.
xs:anyAtom*icType? avg(xs:anyAtom*icType*)
Returns th*e average *of the val*ues in the* input seq*uence $arg
, that is,* the
* sum* of the va*lues divid*ed by the *number of *values.
xs:anyURI?* base-uri()
xs:anyURI?* base-uri(node()?)
Returns th*e base URI* of a node*.
xs:boolean* boolean(item()*)
Computes t*he effecti*ve boolean* value of *the sequen*ce $arg
.
xs:numeric*? ceiling(xs:numeric*?)
Rounds $arg
upwards t*o a whole *number.
xs:boolean*? codepoint-*equal(xs:string?*, xs:string?*)
Returns tr*ue if two *strings ar*e equal, c*onsidered *codepoint-*by-codepoi*nt.
xs:string codepoints*-to-string*(xs:integer**)
Creates an* xs:string
from a se*quence of *codepoints*.
xs:anyAtom*icType collation-*key(xs:string)
xs:anyAtom*icType collation-*key(xs:string, xs:string)
Given a st*ring value* and a col*lation, ge*nerates an* internal *value call*ed a colla*tion key, *with the p*roperty th*at * the m*atching an*d ordering* of collat*ion keys r*eflects th*e matching* and order*ing of str*ings under* the speci*fied colla*tion.
node()* collection*()
node()* collection*(xs:string?*)
Returns a *sequence o*f nodes re*presenting* a collect*ion of doc*uments ind*entified b*y a * coll*ection URI*; or a def*ault colle*ction if n*o URI is s*upplied.
xs:integer*? compare(xs:string?*, xs:string?*)
xs:integer*? compare(xs:string?*, xs:string?*, xs:string)
Returns -1*, 0, or 1,* depending* on whethe*r $comparand*1
collates *before,
* *equal to, *or after $comparand*2
according* to the ru*les of a s*elected
* *collation.*
xs:boolean* contains(xs:string?*, xs:string?*)
xs:boolean* contains(xs:string?*, xs:string?*, xs:string)
xs:boolean* contains(map(*), xs:anyAtom*icType)
Returns tr*ue if the *string $arg1
contains *$arg2
as a
* su*bstring, t*aking coll*ations int*o account.*
Tests whet*her a supp*lied map c*ontains an* entry for* a given k*ey
xs:boolean* contains-t*oken(xs:string**, xs:string)
xs:boolean* contains-t*oken(xs:string**, xs:string, xs:string)
Determines* whether o*r not any *of the sup*plied stri*ngs, when *tokenized *at whitesp*ace bounda*ries, cont*ains the s*upplied to*ken, * und*er the rul*es of the *supplied c*ollation.
xs:integer* count(item()*)
Returns th*e number o*f items in* a sequenc*e.
xs:date current-da*te()
Returns th*e current *date.
xs:dateTim*eStamp current-da*teTime()
Returns th*e current *date and t*ime (with *timezone).*
xs:time current-ti*me()
Returns th*e current *time.
xs:anyAtom*icType* data()
xs:anyAtom*icType* data(item()*)
Returns th*e result o*f atomizin*g a sequen*ce, that i*s, replaci*ng all nod*es in the *sequence * * by their *typed valu*es.
xs:dateTim*e? dateTime(xs:date?, xs:time?)
Returns an* xs:dateTim*e
value cre*ated by co*mbining an* xs:date
* and an *xs:time
.
xs:integer*? day-from-d*ate(xs:date?)
Returns th*e day comp*onent of a*n xs:date
.
xs:integer*? day-from-d*ateTime(xs:dateTim*e?)
Returns th*e day comp*onent of a*n xs:dateTim*e
.
xs:integer*? days-from-*duration(xs:duratio*n?)
Returns th*e number o*f days in *a duration*.
xs:boolean* deep-equal*(item()*, item()*)
xs:boolean* deep-equal*(item()*, item()*, xs:string)
This func*tion asses*ses whethe*r two sequ*ences are *deep-equal* to each o*ther. To b*e * deep-e*qual, they* must cont*ain items *that are p*airwise de*ep-equal; *and for tw*o items to* * be deep*-equal, th*ey must ei*ther be at*omic value*s that com*pare equal*, or nodes* of the * *same kind,* with the *same name,* whose chi*ldren are *deep-equal*, * or *maps with *matching e*ntries, or* arrays wi*th matchin*g members.*
xs:string default-co*llation()
Returns th*e value of* the defau*lt collati*on propert*y from the* static co*ntext.
xs:anyAtom*icType* distinct-v*alues(xs:anyAtom*icType*)
xs:anyAtom*icType* distinct-v*alues(xs:anyAtom*icType*, xs:string)
Returns th*e values t*hat appear* in a sequ*ence, with* duplicate*s eliminat*ed.
document-n*ode()? doc(xs:string?*)
Retrieves *a document* using a U*RI supplie*d as an xs:string
, and retu*rns the
* *correspond*ing docume*nt node.
xs:boolean* doc-availa*ble(xs:string?*)
The functi*on returns* true if a*nd only if* the funct*ion call fn:doc($ur*i)
* would r*eturn a do*cument nod*e.
xs:anyURI?* document-u*ri()
xs:anyURI?* document-u*ri(node()?)
Returns th*e URI of a* resource *where a do*cument can* be found,* if availa*ble.
element()** element-wi*th-id(xs:string**)
element()** element-wi*th-id(xs:string**, node())
Returns t*he sequenc*e of eleme*nt nodes t*hat have a*n ID
value mat*ching the
* * value of* one or mo*re of the *IDREF
values su*pplied in *$arg
.
xs:boolean* empty(item()*)
Returns tr*ue if the *argument i*s the empt*y sequence*.
xs:string encode-for*-uri(xs:string?*)
Encodes re*served cha*racters in* a string *that is in*tended to *be used in* the path *segment * *of a URI.
xs:boolean* ends-with(xs:string?*, xs:string?*)
xs:boolean* ends-with(xs:string?*, xs:string?*, xs:string)
Returns tr*ue if the *string $arg1
contains *$arg2
as a trai*ling
* sub*string, ta*king colla*tions into* account.
map(*) entry(xs:anyAtom*icType, item()*)
Creates a *map that c*ontains a *single ent*ry (a key-*value pair*).
xs:string?* environmen*t-variable*(xs:string)
Returns th*e value of* a system *environmen*t variable*, if it ex*ists.
none error()
none error(xs:QName?)
none error(xs:QName?, xs:string)
none error(xs:QName?, xs:string, item()*)
Calling th*e fn:error
function *raises an *applicatio*n-defined *error.
xs:string escape-htm*l-uri(xs:string?*)
Escapes a *URI in the* same way *that HTML *user agent*s handle a*ttribute v*alues expe*cted to * *contain UR*Is.
item() exactly-on*e(item()*)
Returns $arg
if it con*tains exac*tly one it*em. Otherw*ise, raise*s an error*.
*
xs:boolean* exists(item()*)
Returns tr*ue if the *argument i*s a non-em*pty sequen*ce.
xs:boolean* false()
Returns th*e xs:boolean*
value false
.
item()* filter(item()*, function(i*tem()) as *xs:boolean*)
array(*) filter(array(*), function(i*tem()*) as* xs:boolea*n)
Returns th*ose items *from the s*equence $seq for which* the suppl*ied functi*on * $f returns t*rue.
Returns an* array con*taining th*ose member*s of the $array
for which*
* $function
returns t*rue.
xs:numeric*? floor(xs:numeric*?)
Rounds $arg
downwards* to a whol*e number.
item()* fold-left(item()*, item()*, function(i*tem()*, it*em()) as i*tem()*)
array(*) fold-left(array(*), item()*, function(i*tem()*, it*em()*) as *item()*)
Processes *the suppli*ed sequenc*e from lef*t to right*, applying* the suppl*ied functi*on * repea*tedly to e*ach item i*n turn, to*gether wit*h an accum*ulated res*ult value.*
Evaluates *the suppli*ed functio*n cumulati*vely on su*ccessive v*alues of t*he supplie*d * array.*
item()* fold-right*(item()*, item()*, function(i*tem(), ite*m()*) as i*tem()*)
array(*) fold-right*(array(*), item()*, function(i*tem()*, it*em()*) as *item()*)
Processes *the suppli*ed sequenc*e from rig*ht to left*, applying* the suppl*ied functi*on * repea*tedly to e*ach item i*n turn, to*gether wit*h an accum*ulated res*ult value.*
Evaluates *the suppli*ed functio*n cumulati*vely on su*ccessive v*alues of t*he supplie*d * array.*
item()* for-each(item()*, function(i*tem()) as *item()*)
item()* for-each(map(*), function($*key as xs:*anyAtomicT*ype, $valu*e as item(*)*))
array(*) for-each(array(*), function(i*tem()*) as* item()*)
Applies th*e function* item $f to every *item from *the sequen*ce $seq * in turn*, returnin*g the conc*atenation *of the res*ulting seq*uences in *order.
Applies a *supplied f*unction to* every ent*ry in a ma*p, returni*ng the con*catenation* of the * *results.
Returns an* array who*se size is* the same *as array:size*($array)
, in which*
* each me*mber is co*mputed by *applying $function
to the co*rrespondin*g member o*f
* $array
.
item()* for-each-p*air(item()*, item()*, function(i*tem(), ite*m()) as it*em()*)
array(*) for-each-p*air(array(*), array(*), function(i*tem()*, it*em()*) as *item()*)
Applies th*e function* item $f to succes*sive pairs* of items *taken one *from * *$seq1 and one f*rom $seq2, returnin*g the conc*atenation *of the * r*esulting s*equences i*n order.
Returns an* array obt*ained by e*valuating *the suppli*ed functio*n once for* each pair* of member*s at the s*ame positi*on in * th*e two supp*lied array*s.
xs:string?* format-dat*e(xs:date?, xs:string)
xs:string?* format-dat*e(xs:date?, xs:string, xs:string?*, xs:string?*, xs:string?*)
Returns a *string con*taining an* xs:date
value for*matted for* display.
xs:string?* format-dat*eTime(xs:dateTim*e?, xs:string)
xs:string?* format-dat*eTime(xs:dateTim*e?, xs:string, xs:string?*, xs:string?*, xs:string?*)
Returns a *string con*taining an* xs:dateTim*e
value for*matted for* display.
xs:string format-int*eger(xs:integer*?, xs:string)
xs:string format-int*eger(xs:integer*?, xs:string, xs:string?*)
Formats an* integer a*ccording t*o a given *picture st*ring, usin*g the conv*entions of* a given * * natural l*anguage if* specified*.
xs:string format-num*ber(xs:numeric*?, xs:string)
xs:string format-num*ber(xs:numeric*?, xs:string, xs:string?*)
Returns a *string con*taining a *number for*matted acc*ording to *a given pi*cture stri*ng, * taki*ng account* of decima*l formats *specified *in the sta*tic contex*t.
xs:string?* format-tim*e(xs:time?, xs:string)
xs:string?* format-tim*e(xs:time?, xs:string, xs:string?*, xs:string?*, xs:string?*)
Returns a *string con*taining an* xs:time
value for*matted for* display.
xs:integer* function-a*rity(function(**))
Returns th*e arity of* the funct*ion identi*fied by a *function i*tem.
function(**)? function-l*ookup(xs:QName, xs:integer*)
Returns th*e function* having a *given name* and arity*, if there* is one.
xs:QName? function-n*ame(function(**))
Returns th*e name of *the functi*on identif*ied by a f*unction it*em.
xs:string generate-i*d()
xs:string generate-i*d(node()?)
This funct*ion return*s a string* that uniq*uely ident*ifies a gi*ven node. *
item()* get(map(*), xs:anyAtom*icType)
Returns th*e value as*sociated w*ith a supp*lied key i*n a given *map.
xs:boolean* has-childr*en()
xs:boolean* has-childr*en(node()?)
Returns tr*ue if the *supplied n*ode has on*e or more *child node*s (of any *kind).
item()? head(item()*)
item()* head(array(*))
Returns th*e first it*em in a se*quence.
Returns th*e first me*mber of an* array, th*at is $array(1)
.
xs:integer*? hours-from*-dateTime(xs:dateTim*e?)
Returns th*e hours co*mponent of* an xs:dateTim*e
.
xs:integer*? hours-from*-duration(xs:duratio*n?)
Returns th*e number o*f hours in* a duratio*n.
xs:integer*? hours-from*-time(xs:time?)
Returns th*e hours co*mponent of* an xs:time
.
element()** id(xs:string**)
element()** id(xs:string**, node())
Returns th*e sequence* of elemen*t nodes th*at have an* ID
value mat*ching the
* * value of* one or mo*re of the *IDREF
values su*pplied in *$arg
.
node()* idref(xs:string**)
node()* idref(xs:string**, node())
Returns th*e sequence* of elemen*t or attri*bute nodes* with an IDREF
value
* m*atching th*e value of* one or mo*re of the *ID
values su*pplied in
* * $arg
.
xs:dayTime*Duration implicit-t*imezone()
Returns th*e value of* the impli*cit timezo*ne propert*y from the* dynamic c*ontext.
xs:integer** index-of(xs:anyAtom*icType*, xs:anyAtom*icType)
xs:integer** index-of(xs:anyAtom*icType*, xs:anyAtom*icType, xs:string)
Returns a *sequence o*f positive* integers *giving the* positions* within th*e sequence*
* $seq
of items *that are e*qual to $search
.
node()* innermost(node()*)
Returns ev*ery node w*ithin the *input sequ*ence that *is not an *ancestor o*f another *member * o*f the inpu*t sequence*; the node*s are retu*rned in do*cument ord*er with du*plicates * * eliminate*d.
xs:string** in-scope-p*refixes(element())
Returns th*e prefixes* of the in*-scope nam*espaces fo*r an eleme*nt node.
item()* insert-bef*ore(item()*, xs:integer*, item()*)
array(*) insert-bef*ore(array(*), xs:integer*, item()*)
Returns a *sequence c*onstructed* by insert*ing an ite*m or a seq*uence of i*tems at a *given * po*sition wit*hin an exi*sting sequ*ence.
Constructs* an array *by adding *one new me*mber at a *specified *position.
xs:string iri-to-uri*(xs:string?*)
Converts a* string co*ntaining a*n IRI into* a URI acc*ording to *the rules *of [RFC 3987].
array(*) join(array(*)*)
Concatenat*es the con*tents of s*everal arr*ays into a* single ar*ray.
item()? json-doc(xs:string?*)
item()? json-doc(xs:string?*, map(*))
Reads an e*xternal re*source con*taining JS*ON, and re*turns the *result of *parsing th*e resource* as JSON.
xs:anyAtom*icType* keys(map(*))
Returns a *sequence c*ontaining *all the ke*ys present* in a map
xs:boolean* lang(xs:string?*)
xs:boolean* lang(xs:string?*, node())
This funct*ion tests *whether th*e language* of $node
, or the c*ontext ite*m if
* the* second ar*gument is *omitted, a*s specifie*d by xml:lang
attribute*s is the
* * same as, *or is a su*blanguage *of, the la*nguage spe*cified by *$testlang
.
xs:integer* last()
Returns th*e context *size from *the dynami*c context.*
map(*) load-xquer*y-module(xs:string)
map(*) load-xquer*y-module(xs:string, map(*))
Provides a*ccess to t*he public *functions *and global* variables* of a dyna*mically-lo*aded XQuer*y library *module.
xs:string local-name*()
xs:string local-name*(node()?)
Returns th*e local pa*rt of the *name of $arg
as an xs:string
* that is* either th*e zero-len*gth string*, or has t*he lexical* form of a*n
* xs:NCName
.
xs:NCName?* local-name*-from-QNam*e(xs:QName?)
Returns th*e local pa*rt of the *supplied Q*Name.
xs:string lower-case*(xs:string?*)
Converts a* string to* lower cas*e.
xs:boolean* matches(xs:string?*, xs:string)
xs:boolean* matches(xs:string?*, xs:string, xs:string)
Returns tr*ue if the *supplied s*tring matc*hes a give*n regular *expression*.
xs:anyAtom*icType? max(xs:anyAtom*icType*)
xs:anyAtom*icType? max(xs:anyAtom*icType*, xs:string)
Returns a *value that* is equal *to the hig*hest value* appearing* in the in*put sequen*ce.
map(*) merge(map(*)*)
Creates a *new map th*at combine*s entries *from a num*ber of exi*sting maps*.
xs:anyAtom*icType? min(xs:anyAtom*icType*)
xs:anyAtom*icType? min(xs:anyAtom*icType*, xs:string)
Returns a *value that* is equal *to the low*est value *appearing *in the inp*ut sequenc*e.
xs:integer*? minutes-fr*om-dateTim*e(xs:dateTim*e?)
Returns th*e minute c*omponent o*f an xs:dateTim*e
.
xs:integer*? minutes-fr*om-duratio*n(xs:duratio*n?)
Returns th*e number o*f minutes *in a durat*ion.
xs:integer*? minutes-fr*om-time(xs:time?)
Returns th*e minutes *component *of an xs:time
.
xs:integer*? month-from*-date(xs:date?)
Returns th*e month co*mponent of* an xs:date
.
xs:integer*? month-from*-dateTime(xs:dateTim*e?)
Returns th*e month co*mponent of* an xs:dateTim*e
.
xs:integer*? months-fro*m-duration*(xs:duratio*n?)
Returns th*e number o*f months i*n a durati*on.
xs:string name()
xs:string name(node()?)
Returns th*e name of *a node, as* an xs:string
that is e*ither the *zero-lengt*h
* string*, or has t*he lexical* form of a*n xs:QName
.
xs:anyURI namespace-*uri()
xs:anyURI namespace-*uri(node()?)
Returns th*e namespac*e URI part* of the na*me of $arg
, as an
* * xs:anyURI
value.
xs:anyURI?* namespace-*uri-for-pr*efix(xs:string?*, element())
Returns th*e namespac*e URI of o*ne of the *in-scope n*amespaces *for $element
,
* identi*fied by it*s namespac*e prefix.
xs:anyURI?* namespace-*uri-from-Q*Name(xs:QName?)
Returns th*e namespac*e URI part* of the su*pplied QNa*me.
xs:boolean* nilled()
xs:boolean*? nilled(node()?)
Returns tr*ue for an *element th*at is nilled.
xs:QName? node-name()
xs:QName? node-name(node()?)
Returns th*e name of *a node, as* an xs:QName
.
xs:string normalize-*space()
xs:string normalize-*space(xs:string?*)
Returns th*e value of* $arg
with lead*ing and tr*ailing whi*tespace re*moved, and*
* sequenc*es of inte*rnal white*space redu*ced to a s*ingle spac*e characte*r.
xs:string normalize-*unicode(xs:string?*)
xs:string normalize-*unicode(xs:string?*, xs:string)
Returns th*e value of* $arg
after app*lying Unic*ode normal*ization.
xs:boolean* not(item()*)
Returns true
if the ef*fective bo*olean valu*e of $arg
is
* false
, or false
if it is *true
.
xs:double number()
xs:double number(xs:anyAtom*icType?)
Returns th*e value in*dicated by* $arg
or, if $arg
is not
* *specified,* the conte*xt item af*ter atomiz*ation, con*verted to *an xs:double
.
*
item()+ one-or-mor*e(item()*)
Returns $arg
if it con*tains one *or more it*ems. Other*wise, rais*es an erro*r.
*
node()* outermost(node()*)
Returns ev*ery node w*ithin the *input sequ*ence that *has no anc*estor that* is itself* a * membe*r of the i*nput seque*nce; the n*odes are r*eturned in* document *order with* duplicate*s * elimin*ated.
xs:dateTim*e? parse-ietf*-date(xs:string?*)
Parses a s*tring cont*aining the* date and *time in IE*TF format,* returning* the corre*sponding
* * xs:dateTim*e
value.
item()? parse-json*(xs:string?*)
item()? parse-json*(xs:string?*, map(*))
Parses a s*tring supp*lied in th*e form of *a JSON tex*t, returni*ng the res*ults typic*ally in th*e form * o*f a map or* array.
document-n*ode(elemen*t(*))? parse-xml(xs:string?*)
This funct*ion takes *as input a*n XML docu*ment repre*sented as *a string, *and return*s the * do*cument nod*e at the r*oot of an *XDM tree r*epresentin*g the pars*ed documen*t.
document-n*ode()? parse-xml-*fragment(xs:string?*)
This funct*ion takes *as input a*n XML exte*rnal entit*y represen*ted as a s*tring, and* returns * * the docum*ent node a*t the root* of an XDM* tree repr*esenting t*he parsed *document * * fragment.*
xs:string?* path()
xs:string?* path(node()?)
Returns a *path expre*ssion that* can be us*ed to sele*ct the sup*plied node* relative *to the * r*oot of its* containin*g document*.
xs:integer* position()
Returns th*e context *position f*rom the dy*namic cont*ext.
xs:NCName?* prefix-fro*m-QName(xs:QName?)
Returns th*e prefix c*omponent o*f the supp*lied QName*.
map(*) put(map(*), xs:anyAtom*icType, item()*)
Creates a *map that a*dds a sing*le entry t*o an exist*ing map, o*r replaces* a single *entry in a*n existing* map.
xs:QName QName(xs:string?*, xs:string)
Constructs* an xs:QName
value giv*en a names*pace URI a*nd a lexic*al QName.
map(xs:str*ing, item(*)) random-num*ber-genera*tor()
map(xs:str*ing, item(*)) random-num*ber-genera*tor(xs:anyAtom*icType)
Returns a *random num*ber genera*tor, which* can be us*ed to gene*rate seque*nces of ra*ndom numbe*rs.
item()* remove(item()*, xs:integer*)
map(*) remove(map(*), xs:anyAtom*icType)
array(*) remove(array(*), xs:integer*)
Returns a *new sequen*ce contain*ing all th*e items of* $target
except th*e item
* a*t position* $position
.
Constructs* a new map* by removi*ng an entr*y from an *existing m*ap
Constructs* an array *by removin*g the memb*er of a su*pplied arr*ay at a sp*ecified po*sition.
xs:string replace(xs:string?*, xs:string, xs:string)
xs:string replace(xs:string?*, xs:string, xs:string, xs:string)
Returns a *string pro*duced from* the input* string by* replacing* any subst*rings that* match a * * given reg*ular expre*ssion with* a supplie*d replacem*ent string*.
xs:QName? resolve-QN*ame(xs:string?*, element())
Returns an* xs:QName
value (th*at is, an *expanded-Q*Name) by t*aking an
* * xs:string
that has *the lexica*l form of *an xs:QName
(a
* stri*ng in the *form "pref*ix:local-n*ame" or "l*ocal-name"*) and reso*lving it u*sing the
* * in-scope *namespaces* for a giv*en element*.
xs:anyURI?* resolve-ur*i(xs:string?*)
xs:anyURI?* resolve-ur*i(xs:string?*, xs:string)
Resolves a* relative *IRI refere*nce agains*t an absol*ute IRI.
item()* reverse(item()*)
array(*) reverse(array(*))
Reverses t*he order o*f items in* a sequenc*e.
Returns an* array con*taining al*l the memb*ers of a s*upplied ar*ray, but i*n reverse *order.
node() root()
node()? root(node()?)
Returns th*e root of *the tree t*o which $arg
belongs. *This will *usually, b*ut
* not n*ecessarily*, be a doc*ument node*.
xs:numeric*? round(xs:numeric*?)
xs:numeric*? round(xs:numeric*?, xs:integer*)
Rounds a v*alue to a *specified *number of *decimal pl*aces, roun*ding upwar*ds if two *such * val*ues are eq*ually near*.
xs:numeric*? round-half*-to-even(xs:numeric*?)
xs:numeric*? round-half*-to-even(xs:numeric*?, xs:integer*)
Rounds a v*alue to a *specified *number of *decimal pl*aces, roun*ding to ma*ke the las*t digit * *even if tw*o such val*ues are eq*ually near*.
xs:decimal*? seconds-fr*om-dateTim*e(xs:dateTim*e?)
Returns th*e seconds *component *of an xs:dateTim*e
.
xs:decimal*? seconds-fr*om-duratio*n(xs:duratio*n?)
Returns th*e number o*f seconds *in a durat*ion.
xs:decimal*? seconds-fr*om-time(xs:time?)
Returns th*e seconds *component *of an xs:time
.
xs:string serialize(item()*)
xs:string serialize(item()*, element(ou*tput:seria*lization-p*arameters)*?)
This funct*ion serial*izes the s*upplied in*put sequen*ce $arg
as descri*bed in
* * [XSLT and X*Query Seri*alization *3.0], returnin*g the seri*alized rep*resentatio*n
* of the* sequence *as a strin*g.
xs:integer* size(map(*))
xs:integer* size(array(*))
Returns th*e number o*f entries *in the sup*plied map.*
Returns th*e number o*f members *in the sup*plied arra*y.
item()* sort(item()*)
item()* sort(item()*, function(i*tem()) as *xs:anyAtom*icType*)
array(*) sort(array(*))
array(*) sort(array(*), function(i*tem()*) as* xs:anyAto*micType*)
Sorts a su*pplied seq*uence, bas*ed on the *value of a* sort key *supplied a*s a functi*on.
Sorts a su*pplied arr*ay, based *on the val*ue of a so*rt key sup*plied as a* function.*
xs:boolean* starts-wit*h(xs:string?*, xs:string?*)
xs:boolean* starts-wit*h(xs:string?*, xs:string?*, xs:string)
Returns tr*ue if the *string $arg1
contains *$arg2
as a lead*ing
* subs*tring, tak*ing collat*ions into *account.
xs:anyURI?* static-bas*e-uri()
This funct*ion return*s the valu*e of the S*tatic Base* URI prope*rty from t*he static * * context.*
xs:string string()
xs:string string(item()?)
Returns th*e value of* $arg
represent*ed as an xs:string
.
xs:string string-joi*n(xs:string**)
xs:string string-joi*n(xs:string**, xs:string)
Returns a *string cre*ated by co*ncatenatin*g the item*s in a seq*uence, wit*h a define*d * separa*tor betwee*n adjacent* items.
xs:integer* string-len*gth()
xs:integer* string-len*gth(xs:string?*)
Returns th*e number o*f characters* in a stri*ng.
xs:integer** string-to-*codepoints*(xs:string?*)
Returns th*e sequence* of codepoints* that cons*titute an
* * xs:string
value.
array(*) subarray(array(*), xs:integer*)
array(*) subarray(array(*), xs:integer*, xs:integer*)
Gets an ar*ray contai*ning all m*embers fro*m a suppli*ed array s*tarting at* a supplie*d * positi*on, up to *a specifie*d length.
item()* subsequenc*e(item()*, xs:double)
item()* subsequenc*e(item()*, xs:double, xs:double)
Returns th*e contiguo*us sequenc*e of items* in the va*lue of $sourceSeq*
* beginni*ng at the *position i*ndicated b*y the valu*e of $startingL*oc
and
* con*tinuing fo*r the numb*er of item*s indicate*d by the v*alue of $length
.
xs:string substring(xs:string?*, xs:double)
xs:string substring(xs:string?*, xs:double, xs:double)
Returns th*e portion *of the val*ue of $sourceStr*ing
beginning* at the po*sition
* i*ndicated b*y the valu*e of $start
and conti*nuing for *the number* of characters* indicated* by the va*lue of
* $length
.
xs:string substring-*after(xs:string?*, xs:string?*)
xs:string substring-*after(xs:string?*, xs:string?*, xs:string)
Returns th*e part of *$arg1
that foll*ows the fi*rst occurr*ence of
* * $arg2
, taking c*ollations *into accou*nt.
xs:string substring-*before(xs:string?*, xs:string?*)
xs:string substring-*before(xs:string?*, xs:string?*, xs:string)
Returns th*e part of *$arg1
that prec*edes the f*irst occur*rence of
* * $arg2
, taking c*ollations *into accou*nt.
xs:anyAtom*icType sum(xs:anyAtom*icType*)
xs:anyAtom*icType? sum(xs:anyAtom*icType*, xs:anyAtom*icType?)
Returns a *value obta*ined by ad*ding toget*her the va*lues in $arg
.
item()* tail(item()*)
array(*) tail(array(*))
Returns al*l but the *first item* in a sequ*ence.
Returns an* array con*taining al*l members *except the* first fro*m a suppli*ed array.
xs:dayTime*Duration? timezone-f*rom-date(xs:date?)
Returns th*e timezone* component* of an xs:date
.
xs:dayTime*Duration? timezone-f*rom-dateTi*me(xs:dateTim*e?)
Returns th*e timezone* component* of an xs:dateTim*e
.
xs:dayTime*Duration? timezone-f*rom-time(xs:time?)
Returns th*e timezone* component* of an xs:time
.
xs:string** tokenize(xs:string?*)
xs:string** tokenize(xs:string?*, xs:string)
xs:string** tokenize(xs:string?*, xs:string, xs:string)
Returns a *sequence o*f strings *constructe*d by split*ting the i*nput where*ver a sepa*rator is * * found; th*e separato*r is any s*ubstring t*hat matche*s a given *regular ex*pression.
item()* trace(item()*)
item()* trace(item()*, xs:string)
Provides a*n executio*n trace in*tended to *be used in* debugging* queries.
map(*) transform(map(*))
Invokes a *transforma*tion using* a dynamic*ally-loade*d XSLT sty*lesheet.
xs:string translate(xs:string?*, xs:string, xs:string)
Returns th*e value of* $arg
modified *by replaci*ng or remo*ving indiv*idual
* ch*aracters. *
xs:boolean* true()
Returns th*e xs:boolean*
value true
.
item()* unordered(item()*)
Returns th*e items of* $sourceSeq*
in an implementa*tion-depen*dent order.
xs:string?* unparsed-t*ext(xs:string?*)
xs:string?* unparsed-t*ext(xs:string?*, xs:string)
The fn:unparse*d-text
function *reads an e*xternal re*source (fo*r example,* a
* file)* and retur*ns a strin*g represen*tation of *the resour*ce.
xs:boolean* unparsed-t*ext-availa*ble(xs:string?*)
xs:boolean* unparsed-t*ext-availa*ble(xs:string?*, xs:string)
Because er*rors in ev*aluating t*he fn:unparse*d-text
function *are
* non-*recoverabl*e, these t*wo functio*ns are pro*vided to a*llow an ap*plication *to determi*ne
* wheth*er a call *with parti*cular argu*ments woul*d succeed.*
xs:string** unparsed-t*ext-lines(xs:string?*)
xs:string** unparsed-t*ext-lines(xs:string?*, xs:string)
The fn:unparse*d-text-lin*es
function *reads an e*xternal re*source (fo*r
* exampl*e, a file)* and retur*ns its con*tents as a* sequence *of strings*, one for *each line *of
* text *in the str*ing repres*entation o*f the reso*urce.
xs:string upper-case*(xs:string?*)
Converts a* string to* upper cas*e.
xs:anyURI** uri-collec*tion()
xs:anyURI** uri-collec*tion(xs:string?*)
Returns a *sequence o*f xs:anyURI
values re*presenting* the URIs *in a resou*rce
* coll*ection.
xs:integer*? year-from-*date(xs:date?)
Returns th*e year com*ponent of *an xs:date
.
xs:integer*? year-from-*dateTime(xs:dateTim*e?)
Returns th*e year com*ponent of *an xs:dateTim*e
.
xs:integer*? years-from*-duration(xs:duratio*n?)
Returns th*e number o*f years in* a duratio*n.
item()? zero-or-on*e(item()*)
Returns $arg
if it con*tains zero* or one it*ems. Other*wise, rais*es an
* er*ror.
This secti*on lists a*ll of the *functions *defined in* the
[XSLT 3.0] specifica*tion. Each*
function *and operat*or is uniq*uely ident*ified with* a URI of *the form:
*“http://www*.w3.org/20*05/xpath-f*unctions#
name”
where name is the na*me of a fu*nction or *operator, *such as
“s*ystem-prop*erty”: http://www*.w3.org/20*05/xpath-f*unctions#s*ystem-prop*erty
.
The normat*ive defini*tions of t*hese funct*ions are i*n the [XSLT 3.0] specifica*tion. For *convenienc*e, a very *brief, non*-normative* summary o*f each fun*ction is p*rovided. F*or details*, follow t*he link on* the “Summ*ary:” intr*oductory t*ext below *each funct*ion.
The funct*ion fn:analyze*-string()
, identifi*ed in sect*ion 3 XSL Transf*ormations *(XSLT) Fun*ctions above,
re*turns resu*lts that a*re always *valid acco*rding to a*n XML Sche*ma specifi*ed in [XPath and *XQuery Fun*ctions and* Operators* 3.1].
That XML* Schema de*fined four* XML eleme*nts and th*ree XML Sc*hema compl*ex types. * The XML e*lements ar*e named:
*
<analyze-s*tring-resu*lt>
<match>
<non-match*>
<group>
The XML S*chema comp*lex types *are named:*
analyze-st*ring-resul*t-type
match-type*
group-type*
The targe*t namespac*e of this *XML Schema* is http://www*.w3.org/20*05/xpath-f*unctions
.
This sche*ma specifi*es the XML* syntax of* the resul*t returned* by fn:analyze*-string
as define*d in
[XPath and *XQuery Fun*ctions and* Operators* 3.1].
It is l*ocated at
*http://www*.w3.org/20*14/10/xpat*h-function*s-31/analy*ze-string.*xsd.
These docu*ments desc*ribe the n*ames that *are define*d in this *namespace *at the tim*e of publi*cation. T*he W3C res*erves the *right to d*efine addi*tional nam*es in this* namespace* in the fu*ture.
XPath and *XQuery Fun*ctions and* Operators* 3.1 (1 Octobe*r 2014 ver*sion)
XSL Transf*ormations *(XSLT) 3.0* (12 Decem*ber 2013 v*ersion)
Resource D*irectory D*escription* Language *(RDDL) (4 July 2*007)
Gleaning R*esource De*scriptions* from Dial*ects of La*nguages (G*RDDL) (Recommen*dation of *11 Septemb*er 2007)
Resource D*escription* Framework* (RDF): Co*ncepts and* Abstract *Syntax (Recommen*dation of *10 Februar*y 2004)