Eeny Meeny Moo
问题描述 :
Surely you have made the experience that when too many people use the Internet simultaneously, the net becomes very, very slow.
To put an end to this problem, the University of Ulm has developed a contingency scheme for times of peak load to cut off net access for some cities of the country in a systematic, totally fair manner. Germany’s cities were enumerated randomly from 1 to n. Freiburg was number 1, Ulm was number 2, Karlsruhe was number 3, and so on in a purely random order.
Then a number m would be picked at random, and Internet access would first be cut off in city 1 (clearly the fairest starting point) and then in every mth city after that, wrapping around to 1 after n, and ignoring cities already cut off. For example, if n=17 and m=5, net access would be cut off to the cities in the order [1,6,11,16,5,12,2,9,17,10,4,15,14,3,8,13,7]. The problem is that it is clearly fairest to cut off Ulm last (after all, this is where the best programmers come from), so for a given n, the random number m needs to be carefully chosen so that city 2 is the last city selected.
To put an end to this problem, the University of Ulm has developed a contingency scheme for times of peak load to cut off net access for some cities of the country in a systematic, totally fair manner. Germany’s cities were enumerated randomly from 1 to n. Freiburg was number 1, Ulm was number 2, Karlsruhe was number 3, and so on in a purely random order.
Then a number m would be picked at random, and Internet access would first be cut off in city 1 (clearly the fairest starting point) and then in every mth city after that, wrapping around to 1 after n, and ignoring cities already cut off. For example, if n=17 and m=5, net access would be cut off to the cities in the order [1,6,11,16,5,12,2,9,17,10,4,15,14,3,8,13,7]. The problem is that it is clearly fairest to cut off Ulm last (after all, this is where the best programmers come from), so for a given n, the random number m needs to be carefully chosen so that city 2 is the last city selected.
Your job is to write a program that will read in a number of cities n and then determine the smallest integer m that will ensure that Ulm can surf the net while the rest of the country is cut off.
输入:
The input will contain one or more lines, each line containing one integer n with 3 <= n < 150, representing the number of cities in the country.
Input is terminated by a value of zero (0) for n.
Input is terminated by a value of zero (0) for n.
输出:
For each line of the input, print one line containing the integer m fulfilling the requirement specified above.
样例输入:
3 4 5 6 7 8 9 10 11 12 0
样例输出:
2 5 2 4 3 11 2 3 8 16
解题代码:
//* @author<EMAIL_ADDRESS>import java.util.*; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); while(true) { int n=in.nextInt(); if(n==0)break; int i,j,m=1; while(true) { i=0; j=n-1; while(j!=0) { i=(i+m-1)%j; j--; if(i==0) break; } if(j==0) { System.out.println(m); break; } m++; } } } }
(adsbygoogle = window.adsbygoogle || []).push({});
继续加油哦
图像处理那题解题报告在哪儿呢？
Good task for the group. Hold it up for every yeara??s winner. This is a excellent oppotunity for a lot more enhancement. Indeed, obtaining far better and much better is constantly the crucial. Just like my pal suggests on the truth about ab muscles, he just keeps obtaining much better.
写的好····· Pollard Rho快速因数分解
嗯，尽量吧。题目太多了，很多解题报告是用程序自动发布的，所以就只有代码了
为什么暴力求解方法循环到sqrt(n) 就可以了呢
输出规范写错了哦~
We do not harbor that I couldn’t remove other individuals’ problems whenever this arrived at.
5.1处，反了；“上一个操作符的优先级比操作符ch的优先级大，或栈是空的就入栈。”如代码所述，应为“上一个操作符的优先级比操作符ch的优先级小，或栈是空的就入栈。”
多谢指出，已改正
#!/usr/bin/env python def cou(n): arr = [1]
不需要输出，只要函数返回值正确就行
第63行是不是漏了 return 1 + dis_right; ?
a是根先忽略掉，递归子树。剩下前缀bejkcfghid和后缀jkebfghicd，分拆的原则的是每个子树前缀和后缀的节点个数是一样的，根节点出现在前缀的第一个，后缀的最后一个。根节点b出现后缀的第四个位置，则第一部分为四个节点，前缀bejk，后缀jkeb，剩下的c出现在后缀的倒数第2个，就划分为cfghi和 fghic，第3部分就为c、c


Water Erosion Prediction Project Climate Assessment Tool
WEPPCAT
|
Databases
|
Help
|
Acknowledgments
|
Scientific References
|
Links


Sign Up
NAME
SURNAME
E-MAIL
PASSWORD
REPEAT PASSWORD
BRACELET CODE
ALREADY HAVE AN ACCOUNT?
SIGN IN
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form


Overview
Supported Python versions
Kaitai Struct supports Python 3.4 and later as well as Python 2.7. It is strongly recommended to use Python 3.8 or newer, because Python 3.7 and 2.7 have reached end-of-life and no longer receive official support from the Python developers.
Kaitai Struct compiler invocation
To generate Python modules, Kaitai Struct compiler should be invoked with
-t python
option:
kaitai-struct-compiler -t python [--python-package .] my_spec.ksy
This normally generates my_spec.py
parser module.
--python-package
is an optional CLI arg allows you to select a parent package
name used by one generated file to import symbols from another one.
It is recommended to just follow the algorithm:
-
Determine if you need
--python-package
:-
If you don’t intend to embed the KSC-generated files and just want to play a bit in a REPL shell (IPython/Jupyter) in the same dir, omit this arg.
-
If you intend to embed the compilation result into an own package, use
--python-package .
.
-
-
Put all the KSC-generated code into an own subpackage, in example
kaitai
. If your build process regenerates the files on every build, you may want (and probably should, if you don’t care about users being unable to build your package without KSC).gitignore
that dir in order not to junk VCS history.
If you don’t want to follow the algorithm blindly, just read about the actions
involved in the Net and read the discussion in the
PR.
Don’t send us issues about the recommendations/generated code contradicting PEP 8 -
we don’t stick to it. If you want PEP 8 compliant code, you can apply external tools like
autopep8
and black
to generated code.
Installing runtime library
Code generated by Kaitai Struct compiler requires additional runtime library (, sources at GitHub).
Runtime library API version must match compiler version that you’re using (i.e. if you use ksc v0.9, then you must use compatible v0.9 runtime).
If you are using snapshot KSC, you should also use snapshot runtime.
Using release version
With stable version of Kaitai Struct compiler, one can use the following methods:
-
On Debian / Ubuntu, one can install it from apt repositories:
-
Add the following dependency specifier into the package configuration of the packaging tool you use:
kaitaistruct
and then run
python3 -m pip install --upgrade -e ./
in the dir with your project in order to install your package and all its dependencies in an editable way. If you don’t want to package your software, but only install its dependencies, addkaitaistruct
intorequirements.txt
. -
Otherwise, you can just install the package manually using
pip
(Python package manager):python3 -m pip install --upgrade kaitaistruct
Using latest (snapshot) version
If you’re using latest (unreleased aka "bleeding edge" aka "unstable" aka "snapshot" aka "nightly") build of Kaitai Struct compiler, that will require latest runtime libraries as well:
-
You can a make
pip
to use a snapshot version of the runtime by adding a PEP 508 dependency specifier into the config of your favorite build tool:kaitaistruct @ git+https://github.com/kaitai-io/kaitai_struct_python_runtime.git
-
Otherwise, you can just install the package manually using pip (Python package manager):
python3 -m pip install --upgrade --pre git+https://github.com/kaitai-io/kaitai_struct_python_runtime.git
Installing dependencies for legacy Pythons manually
Enums implementation in Python requires enum support as described in PEP-0435. This support is available out of the box in standard libraries since Python v3.4, or since v2.4 using enum34 polyfill.
-
One usually doesn’t need to install this lib manually,
pip
will install it automatically if it is needed. -
One can also install it manually:
-
One can use just
python -m pip install enum34
. Don’t do it on later Pythons or the apps using justenum
will be broken! -
On Debian / Ubuntu, this library can be installed with
sudo apt-get install -y python-enum34
.
-
Automation of compilation process
Setuptools is the de-facto
standard way of building Python packages. This library allows extension
with plugins.
https://gitlab.com/KOLANICH has developed
an extension to setuptools
(GitHub mirror is also present),
allowing you to automate compilation of *.ksy
files as the
part of Python module build process. The library provides a mostly
declarative syntax to facilitate installation: you add a section
[tool.kaitai]
to your pyproject.toml
where you enumerate the files that you want
compiled, output directory, compilation flags, source code.
Post-compilation transformations are currently supported only via legacy syntax via setup.py
. The links to examples can be found in the project docs.
Here are the docs in JSON Schema format.
Please remember that this lib is very unstable and very likely to be improved in a way that changes its API (but due to the API simplicity it’d be easy to fix your code), but I guess it’s much better to use this than to reinvent the wheel. Contributions are welcome!
Please note that this tool is not available on PyPI
and should be installed manually, since currently build_system
of
pyproject.toml
doesn’t support PEP 508 specifiers.


BETTER HOMES REAL ESTATE
Home
Buy
Rent
Contact
Interested in investing?
Name
Telephone
Email
Home Office
+254720000000
betterhomesre@gmail.com


HIER_TOP
returns the topmost ancestor of either all members of a hierarchy or a particular member. The hierarchy can be either level-based or value-based.
VARCHAR2
HIER_TOP ( [member_expression] [WITHIN] {DIMENSION dimension_id | HIERARCHY hierarchy_id} )
Identifies a single dimension member within the hierarchy used for the calculation. If this optional argument is specified, then the result does not vary across dimension members.
The dimension over which the values are calculated using the default hierarchy.
The hierarchy over which the values are calculated. If dimension_id
is used instead, the default hierarchy is used.
This example returns the top member of the default hierarchy of the Time dimension.
HIER_TOP(DIMENSION "TIME")
| Time | Top |
|---|---|
| 2006 | TOTAL |
| Q1.06 | TOTAL |
| Q2.06 | TOTAL |
| Q3.06 | TOTAL |
| Q4.06 | TOTAL |
| JAN-06 | TOTAL |
| FEB-06 | TOTAL |
| MAR-06 | TOTAL |
| APR-06 | TOTAL |
| MAY-06 | TOTAL |
| JUN-06 | TOTAL |
| JUL-06 | TOTAL |
| AUG-06 | TOTAL |
| SEP-06 | TOTAL |
| OCT-06 | TOTAL |
| NOV-06 | TOTAL |
| DEC-06 | TOTAL |
The next example returns TOTAL
, which is the top member for Europe in the default hierarchy of the Customer dimension.
HIER_TOP('EMEA' WITHIN DIMENSION CUSTOMER)


If this field is not empty, its content will be considered as a regular expression to only take into account URI matching it.
Example : ^(HP|Scenario|Search)(-success|-failure)?$


Australian gets 4 months in jail over drunken Bali rampage
DENPASAR, Indonesia: An Australian tourist who fly-kicked a motorcyclist and assaulted a man in his own home during a drunken rampage was jailed for four months on Tuesday (Nov 12).
The ruling comes after Nicholas Carr's antics were caught in a viral video that saw him carry out a campaign of destruction in Seminyak, a popular tourist area on the Indonesian holiday island.
"The defendant Nicholas Carr is found guilty and is sentenced to four months" in jail, presiding judge Soebandi, who goes by one name, told the Denpasar District Court.
A lawyer for Carr, charged with assault and property damage, said the 26-year-old would not appeal the ruling.
He is expected to be released next month because of time already served.
In August, Carr ran barefoot on to a street and shouted expletives before the apprentice builder slammed into the bonnet of a moving car and then fly-kicked an unsuspecting motorcycle rider.
The biker, who was thrown from the moving scooter, sustained minor injuries - later the pair embraced during a court hearing as Carr apologised to the victim.
Carr also shattered a convenience store's glass door before stealing a motorcycle.
Later, he broke into a house where he assaulted the sleeping homeowner, leaving him with injuries, police said earlier.
He was eventually caught by locals and police and taken to hospital.
Pictures that circulated on social media showed at the time showed Carr bloodied and bruised, and trussed with hosepipe and rope.
Shortly after his arrest, Carr apologised and admitted drinking more than 10 small bottles of vodka as well as other alcohol.
After a string of embarrassing incidents by tourists, Bali officials recently warned that boorish visitors may be kicked off the island, which attracts millions annually to its palm-fringed beaches, colourful nightlife and ancient temples.
READ: Australian clubbers busted in Bali over cocaine
Australian professional rugby league player David Fifita returned home this week after he was briefly arrested in Bali for assaulting a nightclub security guard.
Several days after Carr's arrest, a Czech couple who were slammed for disrespecting a Balinese temple took part in a ritual purification ceremony.


Keluro
Access to the project
uxvr.fr
Access to the project
Guide Var
Access to the project
Domicile 90
Access to the project
Previous
-
Next


Captcha solved. Input this ID as the answer of the captcha when posting:
No problem! Solve this captcha here instead.
Answer:


Class ConsoleDriver
ConsoleDriver is an abstract class that defines the requirements for a console driver. One implementation if the CursesDriver, and another one uses the .NET Console one.
Inheritance
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public abstract class ConsoleDriver
Constructors
ConsoleDriver()
Declaration
protected ConsoleDriver ();
Fields
BottomTee
The bottom tee.
Declaration
public Rune BottomTee;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
Diamond
Diamond character
Declaration
public Rune Diamond;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
HLine
Horizontal line character.
Declaration
public Rune HLine;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
LeftTee
Left tee
Declaration
public Rune LeftTee;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
LLCorner
Lower left corner
Declaration
public Rune LLCorner;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
LRCorner
Lower right corner
Declaration
public Rune LRCorner;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
RightTee
Right tee
Declaration
public Rune RightTee;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
Stipple
Stipple pattern
Declaration
public Rune Stipple;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
TopTee
Top tee
Declaration
public Rune TopTee;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
ULCorner
Upper left corner
Declaration
public Rune ULCorner;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
URCorner
Upper right corner
Declaration
public Rune URCorner;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
VLine
Vertical line character.
Declaration
public Rune VLine;
Field Value
| Type | Description |
|---|---|
| System.Rune | To be added. |
Properties
Clip
Controls the current clipping region that AddRune/AddStr is subject to.
Declaration
public Terminal.Gui.Rect Clip { get; set; }
Property Value
| Type | Description |
|---|---|
| Rect | The clip. |
Cols
The current number of columns in the terminal.
Declaration
public abstract int Cols { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | To be added. |
Rows
The current number of rows in the terminal.
Declaration
public abstract int Rows { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | To be added. |
Methods
AddCh(Int32)
Adds the specified rune to the display at the current cursor position
Declaration
public abstract void AddCh (int rune);
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rune | Rune to add. |
AddRune(Rune)
Adds the specified rune to the display at the current cursor position
Declaration
public abstract void AddRune (Rune rune);
Parameters
| Type | Name | Description |
|---|---|---|
| System.Rune | rune | Rune to add. |
AddSpecial(SpecialChar)
Draws a special characters in the screen
Declaration
public abstract void AddSpecial (Terminal.Gui.SpecialChar ch);
Parameters
| Type | Name | Description |
|---|---|---|
| SpecialChar | ch | Ch. |
AddStr(ustring)
Adds the specified
Declaration
public abstract void AddStr (NStack.ustring str);
Parameters
| Type | Name | Description |
|---|---|---|
| NStack.ustring | str | String. |
AddStr(String)
Adds the specified
Declaration
public abstract void AddStr (string str);
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | str | String. |
CookMouse()
Enables the cooked event processing from the mouse driver
Declaration
public abstract void CookMouse ();
DrawFrame(Rect, Int32, Boolean)
Declaration
public virtual void DrawFrame (Terminal.Gui.Rect region, int padding, bool fill);
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | region | To be added. |
| System.Int32 | padding | To be added. |
| System.Boolean | fill | To be added. |
End()
Ends the execution of the console driver.
Declaration
public abstract void End ();
Init(Action)
Initializes the driver
Declaration
public abstract void Init (Action terminalResized);
Parameters
| Type | Name | Description |
|---|---|---|
| System.Action | terminalResized | Method to invoke when the terminal is resized. |
Move(Int32, Int32)
Moves the cursor to the specified column and row.
Declaration
public abstract void Move (int col, int row);
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | col | Column to move the cursor to. |
| System.Int32 | row | Row to move the cursor to. |
PrepareToRun(MainLoop, Action<KeyEvent>, Action<MouseEvent>)
Declaration
public abstract void PrepareToRun (Mono.Terminal.MainLoop mainLoop, Action<Terminal.Gui.KeyEvent> target, Action<Terminal.Gui.MouseEvent> mouse);
Parameters
| Type | Name | Description |
|---|---|---|
| MainLoop | mainLoop | To be added. |
| System.Action<KeyEvent> | target | To be added. |
| System.Action<MouseEvent> | mouse | To be added. |
RedrawTop()
Declaration
public abstract void RedrawTop ();
Refresh()
Updates the screen to reflect all the changes that have been done to the display buffer
Declaration
public abstract void Refresh ();
SetAttribute(Attribute)
Declaration
public abstract void SetAttribute (Terminal.Gui.Attribute c);
Parameters
| Type | Name | Description |
|---|---|---|
| Attribute | c | To be added. |
SetColors(Int16, Int16)
Advanced uses - set colors to any pre-set pairs, you would need to init_color that independently with the R, G, B values.
Declaration
public abstract void SetColors (short foregroundColorId, short backgroundColorId);
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int16 | foregroundColorId | Foreground color identifier. |
| System.Int16 | backgroundColorId | Background color identifier. |
SetColors(ConsoleColor, ConsoleColor)
Declaration
public abstract void SetColors (ConsoleColor foreground, ConsoleColor background);
Parameters
| Type | Name | Description |
|---|---|---|
| System.ConsoleColor | foreground | To be added. |
| System.ConsoleColor | background | To be added. |
StartReportingMouseMoves()
Declaration
public abstract void StartReportingMouseMoves ();
StopReportingMouseMoves()
Declaration
public abstract void StopReportingMouseMoves ();
Suspend()
Suspend the application, typically needs to save the state, suspend the app and upon return, reset the console driver.
Declaration
public abstract void Suspend ();
UncookMouse()
Disables the cooked event processing from the mouse driver. At startup, it is assumed mouse events are cooked.
Declaration
public abstract void UncookMouse ();


or xs:untypedAtomic
, in which case the
rules in 19.2 Casting from xs:string and xs:untypedAtomic apply), any list types in the membership
are effectively ignored.
If more than one of these conditions applies, then the casting is done according to the rules for the first condition that applies.
If none of these conditions applies, the cast fails with a dynamic error [err:FORG0001].
Example: consider a type U whose member types are xs:integer
and xs:date
.
The expression "123" cast as U
returns the
xs:integer
value 123
.
The expression current-date() cast as U
returns
the current date as an instance of xs:date
.
The expression 23.1 cast as U
returns the xs:integer
value 23
.
Example: consider a type V whose member types are xs:short
and xs:negativeInteger
.
The expression "-123" cast as V
returns the
xs:short
value -123
.
The expression "-100000" cast as V
returns the
xs:negativeInteger
value -100000
.
The expression 93.7 cast as V
returns the
xs:short
value 93
.
The expression "93.7" cast as V
raises
a dynamic error [err:FORG0001] on the grounds that the string
"93.7"
is not in the lexical space of the union type.
Example: consider a type W that is derived from the above type V
by restriction, with a pattern facet of -?\d\d
.
The expression "12" cast as V
returns the
xs:short
value 12
.
The expression "123" cast as V
raises
an dynamic error [err:FORG0001] on the grounds that the string
"123"
does not match the pattern facet.
If the target type of a cast expression (or a constructor function) is a
type with variety list
, the supplied value must be of type xs:string
or
xs:untypedAtomic
. The rules follow the general principle for
all casts from xs:string
outlined in 19.2 Casting from xs:string and xs:untypedAtomic.
The semantics of the operation are consistent with validation: that is, the effect of casting a string S to a list type L is the same as constructing an element or attribute node whose string value is S, validating it using L as the governing type, and atomizing the resulting node. The result will always be either failure, or a sequence of zero or more atomic values each of which is an instance of the item type of L (or if the item type of L is a union type, an instance of one of the atomic types in its transitive membership).
If the item type of the list type is namespace-sensitive, then the
namespace bindings in the static context will be used to
resolve any namespace prefix, in the same way as when the target type is
xs:QName
.
If the list type has a pattern
facet, the pattern must match
the supplied value after collapsing whitespace (an operation equivalent to the
use of the fn:normalize-space
function).
For example, the expression cast "A B C D" as xs:NMTOKENS
produces a sequence of four xs:NMTOKEN
values,
("A", "B", "C", "D")
.
For example, given a user-defined type my:coordinates
defined
as a list of xs:integer
with the facet <xs:length value="2"/>
,
the expression my:coordinates("2 -1")
will return a sequence of two
xs:integer values (2, -1)
, while the expression my:coordinates("1 2 3")
will result in a dynamic error because the length of the list does not conform to
the
length
facet. The expression my:coordinates("1.0 3.0")
will also fail because the strings 1.0
and 3.0
are not in the lexical space of xs:integer
.
The error text provided with these errors is non-normative.
Raised when fn:apply
is called and the arity of the supplied function is not
the same as the number of members in the supplied array.
This error is raised whenever an attempt is made to divide by zero.
This error is raised whenever numeric operations result in an overflow or underflow.
This error is raised when an integer used to select a member of an array is outside the range of values for that array.
This error is raised when the $length
argument to array:subarray
is negative.
Raised when casting to xs:decimal
if the supplied value exceeds the
implementation-defined limits for the datatype.
Raised by fn:resolve-QName
and fn:QName
when a supplied value does not have the lexical
form of a QName or URI respectively; and when casting to decimal, if the supplied
value is NaN or Infinity.
Raised when casting to xs:integer
if the supplied value exceeds the
implementation-defined limits for the datatype.
Raised when multiplying or dividing a duration by a number, if the number supplied is NaN.
Raised when casting a string to xs:decimal
if the string has more digits of precision
than the implementation can represent (the implementation also has the option of rounding).
Raised by fn:codepoints-to-string
if the input contains an integer that is not the codepoint
of a valid XML character.
Raised by any function that uses a collation if the requested collation is not recognized.
Raised by fn:normalize-unicode
if the requested normalization form is not
supported by the implementation.
Raised by functions such as fn:contains
if the requested collation does
not operate on a character-by-character basis.
Raised by fn:id
, fn:idref
, and fn:element-with-id
if the node that identifies the tree to be searched is a node in a tree whose root
is not
a document node.
Raised by fn:doc
, fn:collection
, and fn:uri-collection
to indicate that either the supplied URI cannot be dereferenced to obtain a resource,
or the resource
that is returned is not parseable as XML.
Raised by fn:doc
, fn:collection
, and fn:uri-collection
to indicate that it is not possible to
return a result that is guaranteed deterministic.
Raised by fn:collection
and fn:uri-collection
if the argument is not a valid xs:anyURI
.
Raised (optionally) by fn:doc
and fn:doc-available
if the argument
is not a valid URI reference.
Raised by fn:parse-xml
if the supplied string is not a well-formed and namespace-well-formed XML document;
or if DTD validation is requested and the document is not valid against its DTD.
Raised when fn:serialize
is called and the processor does not support serialization,
in cases where the host language makes serialization an optional feature.
This error is raised if the decimal format name supplied to fn:format-number
is not a valid QName,
or if the prefix in the QName is undeclared, or if there is no decimal format
in the static context with
a matching name.
This error is raised if the picture string supplied to fn:format-number
or
fn:format-integer
has invalid syntax.
Raised when casting to date/time datatypes, or performing arithmetic with date/time values, if arithmetic overflow or underflow occurs.
Raised when casting to duration datatypes, or performing arithmetic with duration values, if arithmetic overflow or underflow occurs.
Raised by adjust-date-to-timezone
and related functions if the supplied timezone is invalid.
Error code used by fn:error
when no other error code is provided.
This error is raised if the picture string or calendar supplied to fn:format-date
, fn:format-time
,
or fn:format-dateTime
has invalid syntax.
This error is raised if the picture string supplied to fn:format-date
selects a component that is not present in a date, or if the picture string
supplied to fn:format-time
selects a component that is not present in a time.
Raised by functions such as fn:json-doc
, fn:parse-json
or fn:json-to-xml
if the string supplied as input does not conform to the JSON grammar (optionally with
implementation-defined extensions).
Raised by functions such as map:merge
, fn:json-doc
,
fn:parse-json
or fn:json-to-xml
if the input contains duplicate keys, when the chosen policy is to reject duplicates.
Raised by fn:json-to-xml
if validation
is requested when the processor does not support schema validation or typed nodes.
Raised by functions such as map:merge
, fn:parse-json
,
and fn:xml-to-json
if the $options
map contains an invalid entry.
Raised by fn:xml-to-json
if the XML input does not
conform to the rules for the XML representation of JSON.
Raised by fn:xml-to-json
if the XML input uses the attribute
escaped="true"
or escaped-key="true"
, and the corresponding string
or key contains an invalid JSON escape sequence.
Raised by fn:resolve-QName
and analogous functions if a supplied QName has a
prefix that has no binding to a namespace.
Raised by fn:resolve-uri
if no base URI is available for resolving a relative URI.
Raised by fn:load-xquery-module
if the supplied module URI is zero-length.
Raised by fn:load-xquery-module
if no module can be found with the supplied module URI.
Raised by fn:load-xquery-module
if a static error
(including a statically-detected type error) is encountered when processing the library
module.
Raised by fn:load-xquery-module
if a value is supplied for the initial context
item or for an external variable, and the value does not conform to the required
type declared in the dynamically loaded module.
Raised by fn:load-xquery-module
if no XQuery processor is available supporting the requested
XQuery version (or if none is available at all).
A general-purpose error raised when casting, if a cast between two datatypes is allowed in principle, but the supplied value cannot be converted: for example when attempting to cast the string "nine" to an integer.
Raised when either argument to fn:resolve-uri
is not a valid URI/IRI.
Raised by fn:zero-or-one
if the supplied value contains more than one item.
Raised by fn:one-or-more
if the supplied value is an empty sequence.
Raised by fn:exactly-one
if the supplied value is not a singleton sequence.
Raised by functions such as fn:max
, fn:min
, fn:avg
, fn:sum
if the supplied sequence contains values inappropriate to this function.
Raised by fn:dateTime
if the two arguments both have timezones and the timezones are different.
A catch-all error for fn:resolve-uri
, recognizing that the implementation can choose between a variety
of algorithms and that some of these may fail for a variety of reasons.
Raised when the input to fn:parse-ietf-date
does not match the prescribed
grammar, or when it represents an invalid date/time such as 31 February.
Raised by regular expression functions such as fn:matches
and fn:replace
if the
regular expression flags contain a character other than i
, m
, q
, s
, or x
.
Raised by regular expression functions such as fn:matches
and fn:replace
if the
regular expression is syntactically invalid.
For functions such as fn:replace
and fn:tokenize
, raises an error if
the supplied regular expression is capable of matching a zero length string.
Raised by fn:replace
to report errors in the replacement string.
Raised by fn:data
, or by implicit atomization, if applied to a node with no typed value,
the main example being an element validated against a complex type that defines it
to have element-only content.
Raised by fn:data
, or by implicit atomization, if the sequence to be atomized contains
a function item.
Raised by fn:string
, or by implicit string conversion, if the input sequence contains
a function item.
Raised by fn:deep-equal
if either input sequence contains a
function item.
A dynamic error is raised if the $href
argument
contains a fragment identifier, or if it cannot be used to retrieve a resource
containing text.
A dynamic error is raised if the retrieved resource contains octets that cannot be decoded into Unicode ·characters· using the specified encoding, or if the resulting characters are not permitted XML characters. This includes the case where the processor does not support the requested encoding.
A dynamic error is raised if
$encoding
is absent and the processor cannot infer the encoding using external information
and the
encoding is not UTF-8.
A dynamic error is raised if no XSLT processor suitable for evaluating a call on fn:transform
is available.
A dynamic error is raised if the parameters supplied to fn:transform
are invalid, for example
if two mutually-exclusive parameters are supplied. If a suitable XSLT error code is
available (for example in the
case where the requested initial-template
does not exist in the stylesheet), that error code should
be used in preference.
A dynamic error is raised if an XSLT transformation invoked using fn:transform
fails with a
static or dynamic error. The XSLT error code is used if available; this error code
provides a fallback when no XSLT
error code is returned, for example because the processor is an XSLT 1.0 processor.
A dynamic error is raised if the fn:transform
function is invoked when XSLT transformation (or a specific
transformation option) has been disabled for security or other reasons.
A dynamic error is raised if the fn:transform
function uses delivery-format:saved
and
the output of the transformation cannot be saved at the requested location.
A dynamic error is raised if the result of the fn:transform
function contains characters available
only in XML 1.1 and the calling processor cannot handle such characters.
A dynamic error is raised if the the fn:transform
function uses delivery-format:saved
in
a way that violates implementation-defined conditions on its use.
Two functions in this specification, fn:analyze-string
and
fn:json-to-xml
, produce results in the form of an XDM node tree that must conform
to a specified schema. In both cases the elements in the result are in the namespace
http://www.w3.org/2005/xpath-functions
, which is therefore the target namespace
of the relevant schema document.
The schema for this namespace is organized as three schema documents. The first is a simple umbrella document that includes the other two. A copy can be found at xpath-functions.xsd:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/2005/xpath-functions"> <!-- * This is a schema for the namespace http://www.w3.org/2005/xpath-functions * * The schema is made available under the terms of the W3C software notice and license * at http://www.w3.org/Consortium/Legal/copyright-software-19980720 * * The schema includes two schema documents, containing definitions of the structure * of the results of the fn:analyze-string and fn:json-to-xml functions respectively. * --> <xs:include schemaLocation="analyze-string.xsd"/> <xs:include schemaLocation="schema-for-json.xsd"/> </xs:schema>
fn:analyze-string
This schema describes the output of the function fn:analyze-string
.
The schema is reproduced below, and can also be found in analyze-string.xsd:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/2005/xpath-functions" xmlns:fn="http://www.w3.org/2005/xpath-functions" elementFormDefault="qualified"> <!-- * This is a schema for the XML representation of JSON used as the target for the * function fn:analyze-string() * * The schema is made available under the terms of the W3C software notice and license * at http://www.w3.org/Consortium/Legal/copyright-software-19980720 * --> <xs:element name="analyze-string-result" type="fn:analyze-string-result-type"/> <xs:element name="match" type="fn:match-type"/> <xs:element name="non-match" type="xs:string"/> <xs:element name="group" type="fn:group-type"/> <xs:complexType name="analyze-string-result-type" mixed="true"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="fn:match"/> <xs:element ref="fn:non-match"/> </xs:choice> </xs:complexType> <xs:complexType name="match-type" mixed="true"> <xs:sequence> <xs:element ref="fn:group" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="group-type" mixed="true"> <xs:sequence> <xs:element ref="fn:group" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="nr" type="xs:positiveInteger"/> </xs:complexType> </xs:schema>
fn:json-to-xml
This schema describes the output of the function fn:json-to-xml
, and the input to the
function fn:xml-to-json
.
The schema is reproduced below, and can also be found in schema-for-json.xsd:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/2005/xpath-functions" xmlns:j="http://www.w3.org/2005/xpath-functions"> <!-- * This is a schema for the XML representation of JSON used as the target for the * function fn:json-to-xml() * * The schema is made available under the terms of the W3C software notice and license * at http://www.w3.org/Consortium/Legal/copyright-software-19980720 * --> <xs:element name="map" type="j:mapType"> <xs:unique name="unique-key"> <xs:selector xpath="*"/> <xs:field xpath="@key"/> <xs:field xpath="@escaped-key"/> </xs:unique> </xs:element> <xs:element name="array" type="j:arrayType"/> <xs:element name="string" type="j:stringType"/> <xs:element name="number" type="j:numberType"/> <xs:element name="boolean" type="j:booleanType"/> <xs:element name="null" type="j:nullType"/> <xs:complexType name="nullType"> <xs:sequence/> <xs:anyAttribute processContents="skip" namespace="##other"/> </xs:complexType> <xs:complexType name="booleanType"> <xs:simpleContent> <xs:extension base="xs:boolean"> <xs:anyAttribute processContents="skip" namespace="##other"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="stringType"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="escaped" type="xs:boolean" use="optional" default="false"/> <xs:anyAttribute processContents="skip" namespace="##other"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:simpleType name="finiteNumberType"> <xs:restriction base="xs:double"> <!-- exclude positive and negative infinity, and NaN --> <xs:minExclusive value="-INF"/> <xs:maxExclusive value="INF"/> </xs:restriction> </xs:simpleType> <xs:complexType name="numberType"> <xs:simpleContent> <xs:extension base="j:finiteNumberType"> <xs:anyAttribute processContents="skip" namespace="##other"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="arrayType"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="j:map"/> <xs:element ref="j:array"/> <xs:element ref="j:string"/> <xs:element ref="j:number"/> <xs:element ref="j:boolean"/> <xs:element ref="j:null"/> </xs:choice> <xs:anyAttribute processContents="skip" namespace="##other"/> </xs:complexType> <xs:complexType name="mapWithinMapType"> <xs:complexContent> <xs:extension base="j:mapType"> <xs:attributeGroup ref="j:key-group"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="arrayWithinMapType"> <xs:complexContent> <xs:extension base="j:arrayType"> <xs:attributeGroup ref="j:key-group"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="stringWithinMapType"> <xs:simpleContent> <xs:extension base="j:stringType"> <xs:attributeGroup ref="j:key-group"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="numberWithinMapType"> <xs:simpleContent> <xs:extension base="j:numberType"> <xs:attributeGroup ref="j:key-group"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="booleanWithinMapType"> <xs:simpleContent> <xs:extension base="j:booleanType"> <xs:attributeGroup ref="j:key-group"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="nullWithinMapType"> <xs:attributeGroup ref="j:key-group"/> </xs:complexType> <xs:complexType name="mapType"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="map" type="j:mapWithinMapType"> <xs:unique name="unique-key-2"> <xs:selector xpath="*"/> <xs:field xpath="@key"/> </xs:unique> </xs:element> <xs:element name="array" type="j:arrayWithinMapType"/> <xs:element name="string" type="j:stringWithinMapType"/> <xs:element name="number" type="j:numberWithinMapType"/> <xs:element name="boolean" type="j:booleanWithinMapType"/> <xs:element name="null" type="j:nullWithinMapType"/> </xs:choice> <xs:anyAttribute processContents="skip" namespace="##other"/> </xs:complexType> <xs:attributeGroup name="key-group"> <xs:attribute name="key" type="xs:string" use="required"/> <xs:attribute name="escaped-key" type="xs:boolean" use="optional" default="false"/> </xs:attributeGroup> </xs:schema>
This Appendix describes some sources of functions that fall outside the scope of the function library defined in this specification. It includes both function specifications and function implementations. Inclusion of a function in this appendix does not constitute any kind of recommendation or endorsement; neither is omission from this appendix to be construed negatively. This Appendix does not attempt to give any information about licensing arrangements for these function specifications or implementations.
A number of W3C Recommendations make use of XPath, and in some cases such Recommmendations define additional functions to be made available when XPath is used in a specific host language.
The various versions of XSLT have all included additional functions intended to be available only when XPath is used within XSLT, and not in other host language environments. Some of these functions were originally defined in XSLT, and subsequently migrated into the core function library defined in this specification.
Generally, the reason that functions have been defined in XSLT rather than in the core library has been that they required additional static or dynamic context information.
XSLT-defined functions share the core namespace http://www.w3.org/2005/xpath-functions
(but in XPath 1.0
and XSLT 1.0, no namespace was defined for these functions).
The conformance rules for XSLT 3.0 require implementations to support either XPath 3.0 or XPath 3.1. Some of the new functions in XPath 3.1, however, must be supported by all XSLT 3.0 implementations whether or not they implement other parts of XPath 3.1.
The following table lists all functions that have been defined in XSLT 1.0, 2.0, or 3.0, and summarizes their status.
| Function name | Availability |
|---|---|
| fn:accumulator-after | XSLT 3.0 only |
| fn:accumulator-before | XSLT 3.0 only |
| fn:available-system-properties | XSLT 3.0 only |
| fn:collation-key | Common to XSLT 3.0 and XPath 3.1 |
| fn:copy-of | XSLT 3.0 only |
| fn:current | XSLT 1.0, 2.0, and 3.0 |
| fn:current-group | XSLT 2.0 and 3.0 |
| fn:current-grouping-key | XSLT 2.0 and 3.0 |
| fn:current-merge-group | XSLT 3.0 only |
| fn:current-merge-key | XSLT 3.0 only |
| fn:current-output-uri | XSLT 3.0 only |
| fn:document | XSLT 1.0, 2.0, and 3.0 |
| fn:element-available | XSLT 1.0, 2.0, and 3.0 |
| fn:format-date | XSLT 2.0; migrated to XPath 3.0 and 3.1 |
| fn:format-dateTime | XSLT 2.0; migrated to XPath 3.0 and 3.1 |
| fn:format-number | XSLT 1.0 and 2.0; migrated to XPath 3.0 and 3.1 |
| fn:format-time | XSLT 2.0; migrated to XPath 3.0 and 3.1 |
| fn:function-available | XSLT 1.0, 2.0, and 3.0 |
| fn:generate-id | XSLT 1.0 and 2.0; migrated to XPath 3.0 and 3.1 |
| fn:json-to-xml | Common to XSLT 3.0 and XPath 3.1 |
| fn:key | XSLT 1.0, 2.0, and 3.0 |
| fn:regex-group | XSLT 2.0 and 3.0 |
| fn:snapshot | XSLT 3.0 only |
| fn:stream-available | XSLT 3.0 only |
| fn:system-property | XSLT 1.0, 2.0, and 3.0 |
| fn:type-available | XSLT 2.0 and 3.0 |
| fn:unparsed-entity-public-id | XSLT 2.0 and 3.0 |
| fn:unparsed-entity-uri | XSLT 1.0, 2.0, and 3.0 |
| fn:unparsed-text | XSLT 2.0; migrated to XPath 3.0 and 3.1 |
| fn:xml-to-json | Common to XSLT 3.0 and XPath 3.1 |
| map:contains | Common to XSLT 3.0 and XPath 3.1 |
| map:entry | Common to XSLT 3.0 and XPath 3.1 |
| map:find | Common to XSLT 3.0 and XPath 3.1 |
| map:for-each | Common to XSLT 3.0 and XPath 3.1 |
| map:get | Common to XSLT 3.0 and XPath 3.1 |
| map:keys | Common to XSLT 3.0 and XPath 3.1 |
| map:merge | Common to XSLT 3.0 and XPath 3.1 |
| map:put | Common to XSLT 3.0 and XPath 3.1 |
| map:remove | Common to XSLT 3.0 and XPath 3.1 |
| map:size | Common to XSLT 3.0 and XPath 3.1 |
XForms 1.1 is based on XPath 1.0. It adds the following functions to the set defined in XPath 1.0, using the same namespace:
boolean-from-string
, is-card-number
, avg
, min
, max
,
count-non-empty
, index
, power
, random
, compare
,
if
, property
,
digest
, hmac
, local-date
, local-dateTime
, now
,
days-from-date
, days-to-date
, seconds-from-dateTime
, seconds-to-dateTime
,
adjust-dateTime-to-timezone
, seconds
, months
, instance
,
current
, id
, context
, choose
, event
.
XForms 2.0 was first published as a W3C Working Draft, and subsequently as a W3C Community Group specification. These draft specifications do not include any additional functions beyond those in the core XPath specification.
The XQuery Update 1.0 specification defines one additional function in the core namespace
http://www.w3.org/2005/xpath-functions
, namely fn:put
. This function can be used
to write a document to external storage. It is thus unusual in that it has side-effects;
the XQuery Update 1.0
specification defines semantics for updating expressions including this function.
Although XQuery Update 1.0 is defined as an extension of XQuery 1.0, a number of implementors have adapted it, in a fairly intuitive way, to work with later versions of XQuery. At the time of this publication, later versions of the XQuery Update specification remain at Working Draft status.
A number of community groups, with varying levels of formal organization, have defined specifications for additional function libraries to augment the core functions defined in this specification. Many of the resulting function specifications have implementations available for popular XPath, XQuery, and XSLT processors, though the level of support is highly variable.
The first such group was EXSLT. This activity was primarily concerned with augmenting the capability of XSLT 1.0, and many of its specifications were overtaken by core functions that became available in XPath 2.0. EXSLT defined a number of function modules covering:
Dates and Times
Dynamic XPath Evaluation
Common (containing most notably the widely-usednode-set
function)
Math (max
,min
,abs
, and trigonometric functions)
Random Number Generation
Regular Expressions
Sets (operations on sets of nodes including set intersection and difference)
String Manipulation (tokenize, replace, join and split, etc.)
Specifications from the EXSLT group can be found at [EXSLT].
A renewed attempt to define additional function libraries using XPath 2.0 as its baseline formed under the name EXPath. Again, the specifications are in various states of maturity and stability, and implementation across popular processors is patchy. At the time of this publication the function libraries that exist in stable published form include:
Binary (functions for manipulating binary data)
File Handling (reading and writing files)
Geospatial (handling of geographic data)
HTTP Client (sending HTTP requests)
ZIP Facility (reading and creating ZIP files or similar archives)
The EXPath community has also been engaged in other related projects, such as defining packaging standards for distribution of XSLT/XQuery components, and tools for unit testing. Its specifications can be found at [EXPath].
A third activity has operated under the name EXQuery, which as the name suggests has focused on extensions to XQuery. EXQuery has published a single specification, RestXQ, which is primarily a system of function annotations allowing XQuery functions to act as endpoints for RESTful services. It also includes some simple functions to assist with the creation of such services. The RestXQ specification can be found at [EXQuery].
Many useful functions can be written in XSLT or XQuery, and in this case the function implementations themselves can be portable across different XSLT and XQuery processors. This section describes one such library.
FunctX is an open-source library of general-purpose functions, supplied in the form of XQuery 1.0 and XSLT 2.0 implementations. It contains over a hundred functions. Typical examples of these functions are:
Test whether a string is all-whitespace
Trim leading and trailing whitespace
Test whether all the values in a sequence are distinct
Capitalize the first character of a string
Change the namespace of all elements in a tree
Get the number of days in a given month
Get the first or last day in a given month
Get the date of the preceding or following day
Ask whether an element has element-only, mixed, or simple content
Find the position of a node in a sequence
Count words in a string
The FunctX library can be found at [FunctX].
Certain functions that were proposed for inclusion in this function library have been excluded on the basis that it is straightforward for users to implement these functions themselves using XSLT 2.0 or XQuery 1.0.
This Appendix provides sample implementations of some of these functions.
To emphasize that these functions are examples of functions that vendors may write, their names carry the prefix 'eg'. Vendors are free to define such functions in any namespace. A group of vendors may also choose to create a collection of such useful functions and put them in a common namespace.
In some situations, users may want to provide default values for missing
information that may be signaled by elements that are omitted, have no value or
have the empty sequence as their value. For example, a missing middle initial
may be indicated by omitting the element or a non-existent bonus signaled with
an empty sequence. This section includes examples of functions that provide such
defaults. These functions return xs:anyAtomicType*
. Users may want
to write functions that return more specific types.
eg:if-empty
($node
as
node()?
, $value
as
xs:anyAtomicType
) as
xs:anyAtomicType*
If the first argument is the empty sequence or an element without simple or
complex content, eg:if-empty()
returns the second argument; otherwise, it
returns the content of the first argument.
XSLT implementation
<xsl:function name="eg:if-empty" as="xs:anyAtomicType*"> <xsl:param name="node" as="node()?"/> <xsl:param name="value" as="xs:anyAtomicType"/> <xsl:sequence select="($node[child::node()], $value)[1]"/> </xsl:function>
XQuery implementation
declare function eg:if-empty ( $node as node()?, $value as xs:anyAtomicType) as xs:anyAtomicType* { ($node[child::node()], $value)[1] }
eg:if-absent
($node
as
node()?
, $value
as
xs:anyAtomicType
) as
xs:anyAtomicType*
If the first argument is the empty sequence, eg:if-absent()
returns the second
argument; otherwise, it returns the content of the first argument.
XSLT implementation
<xsl:function name="eg:if-absent" as="xs:anyAtomicType*"> <xsl:param name="node" as="node()?"/> <xsl:param name="value" as="xs:anyAtomicType"/> <xsl:sequence select="($node, $value)[1]"/> </xsl:function>
XQuery implementation
declare function eg:if-absent ( $node as node()?, $value as xs:anyAtomicType) as xs:anyAtomicType* { ($node, $value)[1] }
eg:value-union (
|
$arg1 |
as xs:anyAtomicType* ,
|
$arg2 |
as xs:anyAtomicType* ) as xs:anyAtomicType* |
This function returns a sequence containing all the distinct items in $arg1
and $arg2
, in an arbitrary order.
XSLT implementation
<xsl:function name="eg:value-union" as="xs:anyAtomicType*"> <xsl:param name="arg1" as="xs:anyAtomicType*"/> <xsl:param name="arg2" as="xs:anyAtomicType*"/> <xsl:sequence select="fn:distinct-values(($arg1, $arg2))"/> </xsl:function>
XQuery implementation
declare function eg:value-union ( $arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType*) as xs:anyAtomicType* { fn:distinct-values(($arg1, $arg2)) }
eg:value-intersect (
|
$arg1 |
as xs:anyAtomicType* ,
|
$arg2 |
as xs:anyAtomicType* ) as xs:anyAtomicType* |
This function returns a sequence containing all the distinct items that
appear in both $arg1
and $arg2
, in an arbitrary order.
XSLT implementation>
<xsl:function name="eg:value-intersect" as="xs:anyAtomicType*"> <xsl:param name="arg1" as="xs:anyAtomicType*"/> <xsl:param name="arg2" as="xs:anyAtomicType*"/> <xsl:sequence select="fn:distinct-values($arg1[.=$arg2])"/> </xsl:function>
XQuery implementation
declare function eg:value-intersect ( $arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { fn:distinct-values($arg1[.=$arg2]) }
eg:value-except (
|
$arg1 |
as xs:anyAtomicType* ,
|
$arg2 |
as xs:anyAtomicType* ) as xs:anyAtomicType* |
This function returns a sequence containing all the distinct items that
appear in $arg1
but not in $arg2
, in an arbitrary order.
XSLT implementation
<xsl:function name="eg:value-except" as="xs:anyAtomicType*"> <xsl:param name="arg1" as="xs:anyAtomicType*"/> <xsl:param name="arg2" as="xs:anyAtomicType*"/> <xsl:sequence select="fn:distinct-values($arg1[not(.=$arg2)])"/> </xsl:function>
XQuery implementation
declare function eg:value-except ( $arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType*) as xs:anyAtomicType* { fn:distinct-values($arg1[not(.=$arg2)]) }
eg:index-of-node
($seq
as
node()*
, $search
as
node()
) as
xs:integer*
This function returns a sequence of positive integers giving the positions within
the sequence $seq
of nodes that are identical to $search
.
The nodes in the sequence $seq
are compared with
$search
under the rules for the is
operator. If a
node compares identical, then the position of that node in the sequence
$seq
is included in the result.
If the value of $seq
is the empty sequence, or if no node in
$seq
matches $search
, then the empty sequence is returned.
The index is 1-based, not 0-based.
The result sequence is in ascending numeric order.
XSLT implementation
<xsl:function name="eg:index-of-node" as="xs:integer*"> <xsl:param name="seq" as="node()*"/> <xsl:param name="search" as="node()"/> <xsl:sequence select="filter( 1 to count($seq), function($i as xs:integer) as xs:boolean {$seq[$i] is $search} ) "/> </xsl:function>
XQuery implementation
declare function eg:index-of-node($seq as node()*, $search as node()) as xs:integer* { fn:filter( 1 to fn:count($seq), function($i as xs:integer) as xs:boolean {$seq[$i] is $search} ) }
An alternative implementation, which might be faster in systems where indexing into a sequence is slow, is:
declare function eg:index-of-node($seq as node()*, $search as node()) as xs:integer* { fn:for-each-pair( $seq, 1 to fn:count($seq), function($node, $index) { if($node is $search) then $index else () }) }
eg:string-pad
($padString
as
xs:string?
, $padCount
as
xs:integer
) as
xs:string
Returns a xs:string
consisting of a given number of copies of an
xs:string
argument concatenated together.
XSLT implementation
<xsl:function name="eg:string-pad" as="xs:string"> <xsl:param name="padString" as="xs:string?"/> <xsl:param name="padCount" as="xs:integer"/> <xsl:sequence select=" fn:string-join(for $i in 1 to $padCount return $padString)"/> </xsl:function>
XQuery implementation
declare function eg:string-pad ( $padString as xs:string?, $padCount as xs:integer) as xs:string { fn:string-join(for $i in 1 to $padCount return $padString) }
This returns the zero-length string if $padString
is the empty
sequence, which is consistent with the general principle that if an
xs:string
argument is the empty sequence it is treated as if it
were the zero-length string.
eg:distinct-nodes-stable
($arg
as
node()*
) as
node()*
This function illustrates one possible implementation of a distinct-nodes function. It removes duplicate nodes by identity, preserving the first occurrence of each node.
XPath
$arg[empty(subsequence($arg, 1, position()-1) intersect .)]
XSLT implementation
<xsl:function name="eg:distinct-nodes-stable" as="node()*"> <xsl:param name="arg" as="node()*"/> <xsl:sequence select="" fn:fold-left( $arg, (), function($foundSoFar as node()*, $this as node()) as node()* { if ($foundSoFar intersect $this) then $foundSoFar else ($foundSoFar, $this) }) "/> </xsl:function>
XQuery implementation
declare function eg:distinct-nodes-stable ($arg as node()*) as node()* { fn:fold-left( $arg, (), function($foundSoFar as node()*, $this as node()) as node()* { if ($foundSoFar intersect $this) then $foundSoFar else ($foundSoFar, $this) }) };
The fn:min
and fn:max
functions allow one to determine the smallest and largest
values in a set of values, but they do not directly allow one to determine the elements
having the smallest
or largest value for some property, for example the employees earning the highest
or lowest salary. The
functions in this section show how this can be achieved.
The functions take as input an arbitrary sequence of items (typically but not necessarily a sequence of elements) and a function that computes a property value for each of these items. This must be a value of an atomic type for which order comparisons are defined. The functions return those items from the input sequence that have a higher (or lower) value for the given property than any others in the sequence. If there are several that are joint highest (or lowest) then they are all returned.
The function eg:highest
returns the items having the highest value for the supplied function.
XSLT implementation
<xsl:function name="eg:highest" as="item()*"> <xsl:param name="seq" as="item()*"/> <xsl:param name="f" as="function(item()) as xs:anyAtomicType"/> <xsl:sequence select=" fold-left( tail($seq), head($seq), function($highestSoFar as item()*, $this as item()*) as item()* { let $thisValue := $f($this) let $highestValue := $f($highestSoFar[1]) return if ($thisValue gt $highestValue) then $this else if ($thisValue eq $highestValue) then ($highestSoFar, $this) else $highestSoFar })"/> </xsl:function>
XQuery implementation
declare function eg:highest( $seq as item()* $f as function(item()) as xs:anyAtomicType) as item()* { fn:fold-left( fn:tail($seq), fn:head($seq), function($highestSoFar as item()*, $this as item()*) as item()* { let $thisValue := $f($this) let $highestValue := $f($highestSoFar[1]) return if ($thisValue gt $highestValue) then $this else if ($thisValue eq $highestValue) then ($highestSoFar, $this) else $highestSoFar }) };
To find the employees with the highest salary, the function might be called as:
eg:highest(//employee, function($emp){$emp/salary})
The function eg:lowest
returns the items having the lowest value for the supplied function.
XSLT implementation
<xsl:function name="eg:lowest" as="item()*"> <xsl:param name="seq" as="item()*"/> <xsl:param name="f" as="function(item()) as xs:anyAtomicType"/> <xsl:sequence select=" fold-left( tail($seq), head($seq), function($lowestSoFar as item()*, $this as item()*) as item()* { let $thisValue := $f($this) let $lowestValue := $f($lowestSoFar[1]) return if ($thisValue lt $lowestValue) then $this else if ($thisValue eq $lowestValue) then ($lowestSoFar, $this) else $lowestSoFar })"/> </xsl:function>
XQuery implementation
declare function eg:lowest( $seq as item()*, $f as function(item()) as xs:anyAtomicType) as item()* { fn:fold-left( fn:tail($seq), fn:head($seq), function($lowestSoFar as item()*, $this as item()*) as item()* { let $thisValue := $f($this) let $lowestValue := $f($lowestSoFar[1]) return if ($thisValue gt $lowestValue) then $this else if ($thisValue eq $lowestValue) then ($lowestSoFar, $this) else $lowestSoFar }) };
To find the employees with the lowest total number of hours worked, the function might be called as:
eg:lowest(//employee, function($emp){sum($emp/timesheet/period/hours})
It is ·implementation-defined· which version of Unicode is supported, but it is recommended that the most recent version of Unicode be used. (See Conformance.)
It is ·implementation-defined· whether the type system is based on XML Schema 1.0 or XML Schema 1.1. (See Conformance.)
It is ·implementation-defined· whether definitions that rely on XML (for example, the set of valid XML characters) should use the definitions in XML 1.0 or XML 1.1. (See Conformance.)
It is not an error if the options map contains options with names other than those
described in this specification. Implementations may attach an
·implementation-defined· meaning to such entries,
and may define errors that arise if such entries are present with invalid values.
Implementations must ignore such entries unless they have a specific
·implementation-defined· meaning.
Implementations that define additional options in this way should
use values of type xs:QName
as the option names, using an appropriate namespace.
(See Options.)
It is ·implementation-defined· which version of [The Unicode Standard] is supported, but it is recommended that the most recent version of Unicode be used. (See Strings, characters, and codepoints.)
[Definition] Some
functions (such as fn:distinct-values
, fn:unordered
, map:keys
,
and map:for-each
) produce results in an
·implementation-defined· or
·implementation-dependent· order.
In such cases two calls with the same arguments are not guaranteed to produce the
results in the same order. These functions are
said to be nondeterministic with respect to ordering.
(See .)
Where the results of a function are described as being (to a greater or lesser extent) ·implementation-defined· or ·implementation-dependent·, this does not by itself remove the requirement that the results should be deterministic: that is, that repeated calls with the same explicit and implicit arguments must return identical results. (See Properties of functions.)
In the case of a document node $D
returned by the fn:doc
function, or a document node at the root of a tree containing a node returned by the
fn:collection
function, it will always be true that either
fn:document-uri($D)
returns the empty sequence, or that the following
expression is true: fn:doc(fn:document-uri($D))
is $D
. It is
·implementation-defined· whether this guarantee also holds for
document nodes obtained by other means, for example a document node passed as the
initial context node of a query or transformation.
(See fn:document-uri.)
In addition, the values of $value
, converted to an xs:string
,
and $label
(if supplied)
may be directed to a trace data set. The destination of the trace
output is ·implementation-defined·. The format of the trace output is
·implementation-dependent·. The ordering of output from calls of the
fn:trace
function is ·implementation-dependent·.
(See fn:trace.)
They may provide an ·implementation-defined· mechanism that allows users to choose between raising an error and returning a result that is modulo the largest representable integer value. See [ISO 10967]. (See Arithmetic operators on numeric values.)
For xs:decimal
values, let N be the number of digits
of precision supported by the implementation, and let M (M <= N
) be the minimum limit on the number of digits
required for conformance (18 digits for XSD 1.0, 16 digits for XSD 1.1). Then for
addition, subtraction, and multiplication
operations, the returned result should be accurate to N digits of precision, and for division and modulus operations,
the returned result should be accurate to at least M digits of precision.
The actual precision is ·implementation-defined·. If the number
of digits in the mathematical result exceeds the number of digits that the implementation
retains for that operation, the result is truncated or rounded in an ·implementation-defined· manner.
(See Arithmetic operators on numeric values.)
The [IEEE 754-2008] specification also describes handling of
two exception conditions called divideByZero
and invalidOperation
. The
IEEE divideByZero
exception is raised not only by a direct attempt to divide by zero, but also by
operations such as log(0)
. The IEEE invalidOperation
exception is raised by
attempts to call a function with an argument that is outside the function's domain
(for example,
sqrt(-1)
or log(-1)
).
Although IEEE defines these as exceptions, it also defines "default non-stop exception
handling" in
which the operation returns a defined result, typically positive or negative infinity,
or NaN. With this
function library,
these IEEE exceptions do not cause a dynamic error
at the application level; rather they result in the relevant function or operator
returning
the defined non-error result.
The underlying IEEE exception may be notified to the application
or to the user by some ·implementation-defined·
warning condition, but the observable effect on an application
using the functions and operators defined in this specification is simply to return
the defined
result (typically -INF, +INF, or NaN) with no error.
(See Arithmetic operators on numeric values.)
The [IEEE 754-2008] specification distinguishes two NaN values,
a quiet NaN and a signaling NaN. These two values are not distinguishable in the XDM
model:
the value spaces of xs:float
and xs:double
each include only a single
NaN
value. This does not prevent the implementation distinguishing them internally,
and triggering different ·implementation-defined·
warning conditions, but such distinctions do not affect the observable behavior of
an application
using the functions and operators defined in this specification.
(See Arithmetic operators on numeric values.)
The implementation may adopt a different algorithm provided that it is equivalent
to
this formulation in all cases where ·implementation-dependent· or ·implementation-defined· behavior does not affect the outcome, for example,
the implementation-defined precision of the result of xs:decimal
division.
(See op:numeric-integer-divide.)
XSD 1.1 allows the string +INF
as a representation of positive infinity;
XSD 1.0 does not. It is ·implementation-defined· whether XSD 1.1 is
supported.
(See fn:number.)
Any other format token, which indicates a numbering sequence in which that token
represents the number 1 (one) (but see the note below).
It is ·implementation-defined· which
numbering sequences, additional to those listed above, are supported. If an
implementation does not support a numbering sequence represented by the given
token, it must use a format token of 1
.
(See fn:format-integer.)
For all format tokens other than a decimal-digit-pattern, there
may be ·implementation-defined· lower and upper bounds on the range of numbers that
can be formatted using this format token; indeed, for some numbering sequences there
may
be intrinsic limits. For example, the format token ①
(circled
digit one, ①) has a range imposed by the Unicode character repertoire — zero to 20
in Unicode versions prior to 3.2, or zero to 50 in subsequent versions. For the numbering
sequences described above any upper bound imposed by the implementation must
not be less than 1000 (one thousand) and any lower bound must not be
greater than 1. Numbers that fall outside this range must be
formatted using the format token 1
.
(See fn:format-integer.)
The set of languages for which numbering is supported is ·implementation-defined·. If the $lang
argument is absent, or is
set to an empty sequence, or is invalid, or is not a language supported by the
implementation, then the number is formatted using the default language from the dynamic
context.
(See fn:format-integer.)
...either a
or t
, to indicate alphabetic or traditional
numbering respectively, the default being ·implementation-defined·.
(See fn:format-integer.)
It is ·implementation-defined· what combinations of values of the format token, the language, and the cardinal/ordinal modifier are supported. If ordinal numbering is not supported for the combination of the format token, the language, and the string appearing in parentheses, the request is ignored and cardinal numbers are generated instead. (See fn:format-integer.)
The use of the a
or t
modifier disambiguates between numbering
sequences that use letters. In many languages there are two commonly used numbering
sequences that use letters. One numbering sequence assigns numeric values to letters
in
alphabetic sequence, and the other assigns numeric values to each letter in some other
manner traditional in that language. In English, these would correspond to the numbering
sequences specified by the format tokens a
and i
. In some
languages, the first member of each sequence is the same, and so the format token
alone
would be ambiguous. In the absence of the a
or t
modifier, the
default is ·implementation-defined·.
(See fn:format-integer.)
The static context provides a set of decimal formats. One of the decimal formats is unnamed, the others (if any) are identified by a QName. There is always an unnamed decimal format available, but its contents are ·implementation-defined·. (See Defining a decimal format.)
IEEE states that the preferred quantum is language-defined. In this specification, it is ·implementation-defined·. (See Trigonometric and exponential functions.)
IEEE defines various rounding algorithms for inexact results, and states that the choice of rounding direction, and the mechanisms for influencing this choice, are language-defined. In this specification, the rounding direction and any mechanisms for influencing it are ·implementation-defined·. (See Trigonometric and exponential functions.)
The map returned by the fn:random-number-generator
function may contain additional entries beyond
those specified here, but it must match the type map(xs:string, item())
. The meaning of any additional entries
is ·implementation-defined·. To avoid conflict with any future version of this specification, the keys of any
such entries should start with an underscore character.
(See fn:random-number-generator.)
If two query parameters use the same keyword then the last one wins. If a query parameter
uses a keyword or value which is not
defined in this specification then the meaning is ·implementation-defined·. If the implementation recognizes
the meaning of the keyword and value then it should interpret it accordingly; if it does not recognize
the keyword or value then if the fallback
parameter is present with the value no
it should reject
the collation as unsupported, otherwise it should ignore the unrecognized parameter.
(See The Unicode Collation Algorithm.)
The following query parameters are defined. If any parameter is absent, the default is ·implementation-defined· except where otherwise stated. The meaning given for each parameter is non-normative; the normative specification is found in [UTS #35]. (See The Unicode Collation Algorithm.)
HTML5 defines the semantics of equality matching using this collation; it does not
define rules for ordering. If the collation
is used for ordering, the results are ·implementation-defined·. The collation supports collation units and can therefore
be used with functions such as fn:contains
; each Unicode codepoint is a single collation unit.
(See The HTML ASCII Case-Insensitive Collation.)
Because the set of collations that are supported is ·implementation-defined·, an implementation has the option to support all collation URIs, in which case it will never raise this error. (See Choosing a collation.)
It is possible to define collations that do not have the ability to generate collation keys. Supplying such a collation will cause the function to fail. The ability to generate collation keys is an ·implementation-defined· property of the collation. (See fn:collation-key.)
Conforming implementations must support normalization form "NFC" and may support normalization forms "NFD", "NFKC", "NFKD", and "FULLY-NORMALIZED". They may also support other normalization forms with ·implementation-defined· semantics. (See fn:normalize-unicode.)
It is ·implementation-defined· which
version of Unicode (and therefore, of the normalization algorithms and their underlying
data) is supported by the implementation. See [UAX #15] for
details of the stability policy regarding changes to the normalization rules in future
versions of Unicode. If the input string contains codepoints that are unassigned in
the
relevant version of Unicode, or for which no normalization rules are defined, the
fn:normalize-unicode
function leaves such codepoints unchanged. If the
implementation supports the requested normalization form then it must
be able to handle every input string without raising an error.
(See fn:normalize-unicode.)
It is possible to define collations that do not have the ability to decompose a string into units suitable for substring matching. An argument to a function defined in this section may be a URI that identifies a collation that is able to compare two strings, but that does not have the capability to split the string into collation units. Such a collation may cause the function to fail, or to give unexpected results or it may be rejected as an unsuitable argument. The ability to decompose strings into collation units is an ·implementation-defined· property of the collation. (See Functions based on substring matching.)
All minimally conforming processors must support positive year values with a minimum of 4 digits (i.e., YYYY) and a minimum fractional second precision of 1 millisecond or three digits (i.e., s.sss). However, conforming processors may set larger ·implementation-defined· limits on the maximum number of digits they support in these two situations. Processors may also choose to support the year 0000 and years with negative values. The results of operations on dates that cross the year 0000 are ·implementation-defined·. (See Limits and precision.)
...the format token n
, N
,
or Nn
, indicating that the value of the component is to be output by name,
in lower-case, upper-case, or title-case respectively. Components that can be output
by name
include (but are not limited to) months, days of the week, timezones, and eras.
If the processor cannot output these components by name for the chosen calendar and
language
then it must use an ·implementation-defined· fallback representation.
(See The picture string.)
...indicates alphabetic or traditional numbering respectively,
the default being ·implementation-defined·.
This has the same meaning as in the second argument of fn:format-integer
.
(See The picture string.)
The sequence of characters in the (adjusted) first presentation modifier is reversed
(for example,
999'###
becomes ###'999
).
If the result is not a valid decimal digit pattern, then the output is
·implementation-defined·.
(See Formatting Fractional Seconds.)
The output for these components is entirely ·implementation-defined·.
The default presentation modifier for these components is n
, indicating that they are output as names (or
conventional abbreviations), and the chosen names will in many cases depend
on the chosen language: see <IP_ADDRESS> The language, calendar, and place arguments.
(See Formatting Other Components.)
The set of languages, calendars, and places that are supported in the ·date formatting functions· is ·implementation-defined·. When any of these arguments is omitted or is an empty sequence, an ·implementation-defined· default value is used. (See The language, calendar, and place arguments.)
The choice of the names and abbreviations used in any given language is
·implementation-defined·. For example,
one implementation might abbreviate July as Jul
while another uses Jly
. In German,
one implementation might represent Saturday as Samstag
while another
uses Sonnabend
. Implementations may provide mechanisms allowing users to
control such choices.
(See The language, calendar, and place arguments.)
The choice of the names and abbreviations used in any given language for calendar units such as days of the week and months of the year is ·implementation-defined·. (See The language, calendar, and place arguments.)
The calendar value if present must be a valid EQName
(dynamic error: [err:FOFD1340]).
If it is a lexical QName
then it is expanded into an expanded QName
using the statically known namespaces; if it has no prefix then it represents an expanded-QName
in no namespace.
If the expanded QName is in no namespace,
then it must identify a calendar with a designator specified below
(dynamic error: [err:FOFD1340]).
If the expanded QName is in a namespace then it identifies the calendar in an ·implementation-defined· way.
(See The language, calendar, and place arguments.)
At least one of the above calendars must be supported. It is ·implementation-defined· which calendars are supported. (See The language, calendar, and place arguments.)
Various aspects of this processing are ·implementation-defined·. Implementations may provide external configuration options that allow any aspect of the processing to be controlled by the user. In particular:... (See fn:doc.)
It is ·implementation-defined· whether DTD validation and/or schema validation is applied to the source document. (See fn:doc.)
The effect of a fragment identifier in the supplied URI is ·implementation-defined·. One possible interpretation is to treat the fragment identifier as an ID attribute value, and to return a document node having the element with the selected ID value as its only child. (See fn:doc.)
By default, this function is ·deterministic·. This means that repeated calls on the function with the same argument will return the same result. However, for performance reasons, implementations may provide a user option to evaluate the function without a guarantee of determinism. The manner in which any such option is provided is ·implementation-defined·. If the user has not selected such an option, a call to this function must either return a deterministic result or must raise a dynamic error [err:FODC0003]. (See fn:collection.)
By default, this function is ·deterministic·. This means that repeated calls on the function with the same argument will return the same result. However, for performance reasons, implementations may provide a user option to evaluate the function without a guarantee of determinism. The manner in which any such option is provided is ·implementation-defined·. If the user has not selected such an option, a call to this function must either return a deterministic result or must raise a dynamic error [err:FODC0003]. (See fn:uri-collection.)
...the processor may use ·implementation-defined· heuristics to determine the likely encoding, otherwise... (See fn:unparsed-text.)
The fact that the resolution of URIs is defined by a mapping in the dynamic context means that in effect, various aspects of the behavior of this function are ·implementation-defined·. Implementations may provide external configuration options that allow any aspect of the processing to be controlled by the user. In particular:... (See fn:unparsed-text.)
The collation used for matching names is ·implementation-defined·, but must be the same as the collation used to ensure that the names of all environment variables are unique. (See fn:environment-variable.)
The precise process used to construct the XDM instance is ·implementation-defined·. In particular, it is implementation-defined whether DTD and/or schema validation is invoked, and it is implementation-defined whether an XML 1.0 or XML 1.1 parser is used. (See fn:parse-xml.)
The precise process used to construct the XDM instance is ·implementation-defined·. In particular, it is implementation-defined whether an XML 1.0 or XML 1.1 parser is used. (See fn:parse-xml-fragment.)
If the second argument is omitted, or is supplied in the form of an output:serialization-parameters
element, then the values of any serialization parameters that are not explicitly specified
is ·implementation-defined·,
and may depend on the context.
(See fn:serialize.)
If the arguments to fn:function-lookup
identify a function that is present
in the static context of the function call, the function will always return the same
function that a static reference to this function would bind to. If there is no such
function in the static context, then the results depend on what is present in the
dynamic context, which is ·implementation-defined·.
(See fn:function-lookup.)
A sequence of URIs (in the form of xs:string
values) which may be used or ignored in an
·implementation-defined· way....
(See fn:load-xquery-module.)
Values for vendor-defined configuration options for the XQuery processor used to process the request. The key is the name of an option, expressed as a QName: the namespace URI of the QName should be a URI controlled by the vendor of the XQuery processor. The meaning of the associated value is ·implementation-defined·. Implementations should ignore options whose names are in an unrecognized namespace. The ·option parameter conventions· do not apply to this contained map.... (See fn:load-xquery-module.)
If the implementation provides a way of writing or invoking functions
with side-effects, this post-processing function might be used to save
a copy of the result document to persistent storage. For example, if the
implementation provides access to the EXPath File library [EXPath],
then a serialized document might be written to filestore by calling the
file:write
function. Similar mechanisms might be used to issue
an HTTP POST request that posts the result to an HTTP server, or to send
the document to an email recipient. The semantics of calling functions
with side-effects are entirely ·implementation-defined·.
(See fn:transform.)
Calls to fn:transform
can potentially have side-effects
even in the absence of the post-processing option, because the XSLT
specification allows a stylesheet to invoke extension functions
that have side-effects. The semantics in this case are ·implementation-defined·.
(See fn:transform.)
Values for vendor-defined configuration options for the XSLT processor used to process the request. The key is the name of an option, expressed as a QName: the namespace URI of the QName should be a URI controlled by the vendor of the XSLT processor. The meaning of the associated value is ·implementation-defined·. Implementations should ignore options whose names are in an unrecognized namespace. Default is an empty map.... (See fn:transform.)
The input may contain deviations from the grammar of [RFC 7159], which are handled in an ·implementation-defined· way. (Note: some popular extensions include allowing quotes on keys to be omitted, allowing a comma to appear after the last item in an array, allowing leading zeroes in numbers, and allowing control characters such as tab and newline to be present in unescaped form.) Since the extensions accepted are implementation-defined, an error may be raised [err:FOJS0001] if the input does not conform to the grammar. (See fn:parse-json.)
The input may contain deviations from the grammar of [RFC 7159], which are handled in an ·implementation-defined· way. (Note: some popular extensions include allowing quotes on keys to be omitted, allowing a comma to appear after the last item in an array, allowing leading zeroes in numbers, and allowing control characters such as tab and newline to be present in unescaped form.) Since the extensions accepted are implementation-defined, an error may be raised (see below) if the input does not conform to the grammar. (See fn:json-to-xml.)
If ST is xs:float
or
xs:double
, then TV is the
xs:decimal
value, within the set of
xs:decimal
values that the implementation is
capable of representing, that is numerically closest to
SV. If two values are equally close, then the one
that is closest to zero is chosen. If SV is too
large to be accommodated as an xs:decimal
, (see
[XML Schema Part 2: Datatypes Second Edition] for ·implementation-defined· limits on
numeric values) a dynamic error is raised [err:FOCA0001]. If SV is one of the special
xs:float
or xs:double
values
NaN
, INF
, or -INF
, a dynamic
error is raised [err:FOCA0002].
(See Casting to xs:decimal.)
If ST is
xs:decimal
, xs:float
or
xs:double
, then TV is SV
with the fractional part discarded and the value converted to
xs:integer
. Thus, casting 3.1456
returns 3
and -17.89
returns
-17
. Casting 3.124E1
returns 31
. If SV is too large to be
accommodated as an integer, (see [XML Schema Part 2: Datatypes Second Edition] for
·implementation-defined· limits on numeric values) a
dynamic error is
raised [err:FOCA0003]. If SV is
one of the special xs:float
or
xs:double
values NaN
,
INF
, or -INF
, a dynamic error is raised
[err:FOCA0002].
(See Casting to xs:integer.)
In casting to xs:decimal
or to a type derived from xs:decimal
,
if the value is not too large or too small but nevertheless cannot be represented
accurately
with the number of decimal digits available to the implementation, the implementation
may round
to the nearest representable value or may raise a dynamic error [err:FOCA0006].
The choice of rounding algorithm and the choice between rounding and error behavior
and is
·implementation-defined·.
(See Casting from xs:string and xs:untypedAtomic.)
The tz timezone database, available at http://www.iana.org/time-zones. It is ·implementation-defined· which version of the database is used. (See IANA Timezone Database.)
Unicode Standard Annex #15: Unicode Normalization Forms. Ed. Mark Davis and Ken Whistler, Unicode Consortium. The current version is 9.0.0, dated 2016-02-24. As with [The Unicode Standard], the version to be used is ·implementation-defined·. Available at: http://www.unicode.org/reports/tr15/. (See UAX #15.)
The Unicode Consortium, Reading, MA, Addison-Wesley, 2016. The Unicode Standard as updated from time to time by the publication of new versions. See http://www.unicode.org/standard/versions/ for the latest version and additional information on versions of the standard and of the Unicode Character Database. The version of Unicode to be used is ·implementation-defined·, but implementations are recommended to use the latest Unicode version; currently, Version 9.0.0. (See The Unicode Standard.)
Unicode Technical Standard #10: Unicode Collation Algorithm. Ed. Mark Davis and Ken Whistler, Unicode Consortium. The current version is 9.0.0, dated 2016-05-18. As with [The Unicode Standard], the version to be used is ·implementation-defined·. Available at: http://www.unicode.org/reports/tr10/. (See UTS #10.)
Unicode Technical Standard #35: Unicode Locale Data Markup Language. Ed Mark Davis et al, Unicode Consortium. The current version is 29, dated 2016-03-15. As with [The Unicode Standard], the version to be used is ·implementation-defined·. Available at: http://www.unicode.org/reports/tr35/. (See UTS #35.)
Functions are added to manipulate maps and arrays.
Functions are provided to convert data to and from JSON format.
The format-number
function is enhanced to allow formatting using
exponential notation.
Some new collation URIs are standardized:
A family of collation URIs corresponding to the Unicode Collation Algorithm
A URI corresponding to the HTML matching rules (where ASCII letters are case-blind, but non-ASCII letters are not)
As well as functions for maps and arrays, further new functions are added:
fn:apply
(dynamically applies a function to arguments supplied as an array)
fn:collation-key
(generates a key that can be used for collation-based matching)
fn:contains-token
(tests whether a token is present in a whitespace-separated list)
fn:default-language
(returns the default language from the context)
fn:json-doc
(loads and parses a document in JSON format, producing maps and arrays)
fn:json-to-xml
(converts JSON to XML)
fn:load-xquery-module
(dynamically loads an XQuery module, providing access to its global variables and
functions)
fn:parse-ietf-date
(parses a date/time supplied in IETF format)
fn:parse-json
(parses a string in JSON format, producing maps and arrays)
fn:random-number-generator
(generates random numbers)
fn:sort
(sorts a sequence)
fn:transform
(runs an XSLT transformation)
fn:xml-to-json
(converts XML to JSON)
New variants of some existing functions are introduced:
A one-argument form of fn:tokenize
, to handle whitespace-separated strings
A one-argument form of fn:trace
, omitting the $label
argument
The single-argument form of the fn:error
function, like the other forms, now allows the first argument
to be an empty sequence.
Some existing functions are extended to handle maps and arrays: affected functions
include
fn:boolean
, fn:string
, fn:data
, fn:deep-equal
,
and fn:collection
.
The fn:serialize
function can now accept serialization parameters supplied in the form of a map.
An ordering relation is defined for xs:hexBinary
and xs:base64Binary
values.
Functions and operators on numeric values now make use of the new built-in union type
xs:numeric
,
replacing the previous use of numeric
as a label representing a pseudo-type.
For the fn:max
and fn:min
functions, the rules for the dynamic type of the
result value are stricter than in previous versions. In the case where the input sequence
consists entirely of
numeric or xs:anyURI
values of the same primitive type, previous versions required only that the returned
value be an instance of the least common supertype of the input types; this version
requires that the returned value
retains its original type, which means that the same rule now applies to numeric and
xs:anyURI
values
as to values of other primitive types.
An ambiguity relating to the type of the results of functions such as fn:abs
and fn:round
has been resolved. The specification is now explicit, for example, that when fn:abs
is applied to a value
of type xs:positiveInteger
, it is legitimate to return the supplied value unchanged (any other type derived
from xs:integer
is also permitted).
Many edge cases in the functions for formatting dates, times, and numbers are now specified more prescriptively, and in some cases mandate behavior that was previously implementation-defined. For example, the handling of grouping separators when formatting fractional seconds is now spelled out.
The conformance rules have been rewritten to better reflect the relationship with host languages.
The types xs:dayTimeDuration
and xs:yearMonthDuration
are now defined by
reference to XSD 1.1.
References to ISO 8601 are updated to refer to the 2004 edition.
The claim that early normalization is preferred has been removed, as the relevant W3C document has effectively withdrawn this recommendation.
For functions that depend on the static base URI, the specification describes more clearly what happens when the static base URI is absent.
The functions underpinning the operators "<<
", ">>
", is
, union
, except
,
to
, and ",
" have been removed from this document. These operators are fully described in the
XPath and XQuery language specifications, which make no reference to the
specifications that previously
appeared in this document.
Compatibility with versions earlier than 3.0 is now described by reference to the 3.0 version of this Recommendation, which contains detailed information on the topic.
An informative appendix now gives brief details of additional function libraries defined by third parties.
Numerous minor editorial errors have been corrected, and numerous clarifications added.
The (poorly defined) concept of least common subtype is no longer used.
Some minor changes have been made in support of streaming in XSLT 3.0: for example
it is recognized that there
are circumstances in which the fn:last
function may raise dynamic errors related to streaming.
Numerous editorial corrections and clarifications have been made. Except for the most trivial, these can be found listed in the public Bugzilla database, and can be identified by the highlighting in the change-marked version of this document.
The following substantive technical changes have been made:
The rules for determinism of fn:uri-collection
are now identical to the rules for
fn:collection
(Bug 27750).
The fn:collection
function can now return items of any type (not only nodes).
The fn:doc-available
function now returns false, rather than raising an error, when
an invalid URI is supplied (Bug 29404).
The fn:collection
and fn:uri-collection
functions are no longer
required to report a specific error when the supplied URI is invalid
(Bug 29404).
The two functions fn:json-to-xml
and fn:xml-to-json
, previously
in the XSLT 3.0 specification, have been transferred to this specification
(Bug 27997),
and minor changes have been made to fn:parse-json
and fn:json-doc
in the interests of alignment.
The rules for functions that accept an options parameter as a map have been unified, clarified, and moved into a single place (Bug 28196).
Added a suggested (optional) way of referencing CLDR numbering schemes in fn:format-integer
(Bug 27614).
The second argument of fn:serialize
can now be provided in the form of a map, giving serialization
options (Bug 28140).
The new function fn:default-language
has been added. (Bug 28850).
The fn:parse-ietf-date
function now accepts a single-digit hours value (Bug 29496).
Clarified that array:join
when given an empty sequence as input produces an empty array as its result. (Bug
29607).
Provided a suggested interpretation for fragment identifiers in the URI passed to
fn:doc
. (Bug 29608).
The new function array:put
has been added. (Bug 29685).
The function fn:random-number-generator
now accepts an empty sequence
as the first argument. (Bug 29671).
The functions map:remove
and array:remove
can now remove
multiple entries/members in a single call. (Bug 29660).
The rules under which fn:xml-to-json
recognizes map keys as duplicates, especially
when some characters are escaped, have been clarified. (Bug 29588)
The fn:json-to-xml
function now escapes solidus (/
) as
\/
. (Bug 29665)
A new function map:find
is provided to allow recursive searching of nested maps and arrays. (Bug 29743)
The options to the fn:transform
function have been refined. (Bugs 29832 and 29939)
The serialization parameters supplied to fn:transform
have been brought into line with those supplied
to fn:serialize
. (Bugs 29940 and 29943)
To ensure that collation keys can be compared without ambiguity, the fn:collation-key
function
is now defined to return an xs:base64Binary
result. (Bug 29853)
Collation URIs for UCA collations have a new parameter maxVariable
indicating which groups
of characters (for example whitespace and punctuation) should be ignored,
or given reduced significance, when
comparing strings. In addition, most of the parameters in UCA collation
URIs now have interoperable default
values. (Bug 29865)
In addition, a number of technical clarifications have been made:
Clarification of the specialized meaning of the term "primitive type" used throughout section 19 Casting (Bug 27737).
Error conditions and handling of edge cases such as unpaired surrogates are more clearly
defined
for JSON-related functions such as fn:parse-json
.
The description of fn:replace
has been changed to clarify that certain error conditions are not
applicable when the q
flag is present.
The properties of the functions returned by fn:random-number-generator
have been spelt out in more detail.
The rules for the fn:idref
function have been clarified in the edge case where a node contains both IDREF
and non-IDREF items in its typed value (Bug 28238).
The specification of regular expressions is now more careful to distinguish capturing parentheses in a regex from other (non-capturing) parentheses.
The specification of fn:collation-key
has been clarified to make it explicit that the function
follows the general rules for collation URI arguments.
The rules for handling of grouping separators in fn:format-integer
have been spelt out in more detail.
Some rules have been added to disallow nonsensical picture strings in fn:format-number
. Specifically,
the mantissa part cannot consist of a decimal separator on its own; a
grouping separator cannot appear at the end of the integer part
of the picture; and adjacent grouping separators are disallowed. (Bug
28567)
The following corrections have been made:
Bug 30041: removed any ambiguity as to how fn:year-from-date
and
fn:year-from-dateTime
should handle negative (BCE) years.
Bug 30045: corrected an error in the specification of array:fold-left
and array:fold-right
which suggested they should wrap the result in an array, contrary to
all examples, notes, and test cases.
This section summarizes the extent to which this specification is compatible with previous versions.
Version 3.1 of this function library is fully backwards compatible with version 3.0, with the following caveats:
The return type of the result of fn:min
and fn:max
is more strictly prescribed
than in earlier versions.
The behavior of functions when the static base URI is absent is more strictly prescribed than in earlier versions.
In the fn:format-number
function, some picture strings that previously were permitted
but had no defined meaning are now disallowed.
In the fn:format-number
function, the rules as given in XPath/XQuery 3.0, and before that in XSLT 2.0,
resulted in the number zero being formatted as a zero-length string under certain
pictures (for example ".#"
).
This has been deemed a bug rather than a feature, and has been corrected in this version
of the specification.
The return type of the result of fn:collection
is now broader, which may result in errors
when strict static typing is used.
In the fn:format-time
and fn:format-dateTime
functions,
fractional seconds are now truncated towards zero rather than being rounded when necessary
to fit in the
maximum width (previous versions of the specification prescribed rounding, but did
not say what should happen
when a fraction such as 0.999
rounded to 1
).
For compatibility issues regarding earlier versions, see the 3.0 version of this specification.


PROOF A film review by Ken Johnson Copyright 1992 Ken Johnson
95 min., R, Drama, 1992 Director: Jacelyn Moorhouse Cast: Hugo Weaving, Genevieve Picot, Russell Crowe
Hugo Weaving is a blind man who doesn't seem to trust anyone. He takes photos of what is around him as proof that what is there exists. He doesn't trust his housekeeper Genevieve Picot, who likes him very much. Weaving finds Russell Crowe, who he trusts, to describe his photos to him.
PROOF is done by House and Moorhouse Films and is distributed by Fine Line Features (which is a division of New Line Cinema). Although the film's description sounds strange, and initially to me not interesting, I found PROOF to be a very good film, although I don't think that it will appeal to everybody. However, if it comes to your area, I suggest trying it. Later this month, PROOF is going to be released on video. I feel it is worth seeing. On a scale of zero to five, I give PROOF a four. PROOF is rated R for female nudity, adult situations, and explicit language.
The actors all did a good job. Hugo Weaving was very convincing as a blind person. Genevieve Picot was very good as the housekeeper. Russell Crowe was excellent as the young adult who is befriended by Weaving. I don't think that there were any actors in the film that I felt were miscast. The film had an interesting idea, which worked well; however, I wouldn't have wanted to have been the one to describe the film to the producer! When I heard what the film was about, I wasn't quite sure of what to expect. Thankfully the film was more than I expected that it could be.
The script for the film was well written. There were some places in the film when the actors came out with some moronic lines, but not many. The story moves along rather well. It did get a little boring in some places, but those points are few and the interesting parts make up for the slower ones.
-------- Ken Johnson<EMAIL_ADDRESS>.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews