| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.functions.registry; |
| 9 |
|
| 10 |
import net.sf.saxon.functions.*; |
| 11 |
import net.sf.saxon.pattern.AnyNodeTest; |
| 12 |
import net.sf.saxon.pattern.NodeKindTest; |
| 13 |
import net.sf.saxon.type.AnyItemType; |
| 14 |
import net.sf.saxon.type.BuiltInAtomicType; |
| 15 |
import net.sf.saxon.type.NumericType; |
| 16 |
import net.sf.saxon.type.Type; |
| 17 |
import net.sf.saxon.value.BooleanValue; |
| 18 |
import net.sf.saxon.value.StringValue; |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
public class XPath30FunctionSet extends BuiltInFunctionSet { |
| 26 |
|
| 27 |
private static XPath30FunctionSet THE_INSTANCE = new XPath30FunctionSet(); |
| 28 |
|
| 29 |
public static XPath30FunctionSet getInstance() { |
| 30 |
return THE_INSTANCE; |
| 31 |
} |
| 32 |
|
| 33 |
private XPath30FunctionSet() { |
| 34 |
init(); |
| 35 |
} |
| 36 |
|
| 37 |
private void init() { |
| 38 |
|
| 39 |
importFunctionSet(XPath20FunctionSet.getInstance()); |
| 40 |
|
| 41 |
register("analyze-string", 2, RegexFunctionSansFlags.class, NodeKindTest.ELEMENT, |
| 42 |
ONE, XPATH30, LATE | NEW) |
| 43 |
.arg(0, BuiltInAtomicType.STRING, OPT, null) |
| 44 |
.arg(1, BuiltInAtomicType.STRING, ONE, null); |
| 45 |
|
| 46 |
register("analyze-string", 3, AnalyzeStringFn.class, NodeKindTest.ELEMENT, |
| 47 |
ONE, XPATH30, LATE | NEW) |
| 48 |
.arg(0, BuiltInAtomicType.STRING, OPT, null) |
| 49 |
.arg(1, BuiltInAtomicType.STRING, ONE, null) |
| 50 |
.arg(2, BuiltInAtomicType.STRING, ONE, null); |
| 51 |
|
| 52 |
register("available-environment-variables", 0, AvailableEnvironmentVariables.class, BuiltInAtomicType.STRING, |
| 53 |
STAR, XPATH30 | USE_WHEN, LATE); |
| 54 |
|
| 55 |
register("data", 0, ContextItemAccessorFunction.class, BuiltInAtomicType.ANY_ATOMIC, STAR, XPATH30, CITEM | LATE); |
| 56 |
|
| 57 |
register("document-uri", 0, ContextItemAccessorFunction.class, |
| 58 |
BuiltInAtomicType.ANY_URI, OPT, XPATH30, CITEM | LATE); |
| 59 |
|
| 60 |
register("element-with-id", 1, SuperId.ElementWithId.class, NodeKindTest.ELEMENT, STAR, CORE, CITEM | LATE | UO) |
| 61 |
.arg(0, BuiltInAtomicType.STRING, STAR, EMPTY); |
| 62 |
|
| 63 |
register("element-with-id", 2, SuperId.ElementWithId.class, NodeKindTest.ELEMENT, STAR, CORE, UO) |
| 64 |
.arg(0, BuiltInAtomicType.STRING, STAR, EMPTY) |
| 65 |
.arg(1, Type.NODE_TYPE, ONE, null); |
| 66 |
|
| 67 |
register("environment-variable", 1, EnvironmentVariable.class, BuiltInAtomicType.STRING, |
| 68 |
OPT, XPATH30 | USE_WHEN, LATE) |
| 69 |
.arg(0, BuiltInAtomicType.STRING, ONE, null); |
| 70 |
|
| 71 |
register("format-date", 2, FormatDate.class, BuiltInAtomicType.STRING, |
| 72 |
OPT, XSLT | XPATH30, CARD0) |
| 73 |
.arg(0, BuiltInAtomicType.DATE, OPT, null) |
| 74 |
.arg(1, BuiltInAtomicType.STRING, ONE, null); |
| 75 |
|
| 76 |
register("format-date", 5, FormatDate.class, BuiltInAtomicType.STRING, |
| 77 |
OPT, XSLT | XPATH30, CARD0) |
| 78 |
.arg(0, BuiltInAtomicType.DATE, OPT, null) |
| 79 |
.arg(1, BuiltInAtomicType.STRING, ONE, null) |
| 80 |
.arg(2, BuiltInAtomicType.STRING, OPT, null) |
| 81 |
.arg(3, BuiltInAtomicType.STRING, OPT, null) |
| 82 |
.arg(4, BuiltInAtomicType.STRING, OPT, null); |
| 83 |
|
| 84 |
register("format-dateTime", 2, FormatDate.class, BuiltInAtomicType.STRING, |
| 85 |
OPT, XSLT | XPATH30, CARD0) |
| 86 |
.arg(0, BuiltInAtomicType.DATE_TIME, OPT, null) |
| 87 |
.arg(1, BuiltInAtomicType.STRING, ONE, null); |
| 88 |
|
| 89 |
register("format-dateTime", 5, FormatDate.class, BuiltInAtomicType.STRING, |
| 90 |
OPT, XSLT | XPATH30, CARD0) |
| 91 |
.arg(0, BuiltInAtomicType.DATE_TIME, OPT, null) |
| 92 |
.arg(1, BuiltInAtomicType.STRING, ONE, null) |
| 93 |
.arg(2, BuiltInAtomicType.STRING, OPT, null) |
| 94 |
.arg(3, BuiltInAtomicType.STRING, OPT, null) |
| 95 |
.arg(4, BuiltInAtomicType.STRING, OPT, null); |
| 96 |
|
| 97 |
register("format-integer", 2, FormatInteger.class, AnyItemType.getInstance(), ONE, XPATH30, 0) |
| 98 |
.arg(0, BuiltInAtomicType.INTEGER, OPT, null) |
| 99 |
.arg(1, BuiltInAtomicType.STRING, ONE, null); |
| 100 |
|
| 101 |
register("format-integer", 3, FormatInteger.class, AnyItemType.getInstance(), ONE, XPATH30, 0) |
| 102 |
.arg(0, BuiltInAtomicType.INTEGER, OPT, null) |
| 103 |
.arg(1, BuiltInAtomicType.STRING, ONE, null) |
| 104 |
.arg(2, BuiltInAtomicType.STRING, OPT, null); |
| 105 |
|
| 106 |
register("format-number", 2, FormatNumber.class, BuiltInAtomicType.STRING, ONE, XSLT | XPATH30, LATE) |
| 107 |
.arg(0, NumericType.getInstance(), OPT, null) |
| 108 |
.arg(1, BuiltInAtomicType.STRING, ONE, null); |
| 109 |
|
| 110 |
register("format-number", 3, FormatNumber.class, BuiltInAtomicType.STRING, ONE, XSLT | XPATH30, NS | LATE) |
| 111 |
.arg(0, NumericType.getInstance(), OPT, null) |
| 112 |
.arg(1, BuiltInAtomicType.STRING, ONE, null) |
| 113 |
.arg(2, BuiltInAtomicType.STRING, OPT, null); |
| 114 |
|
| 115 |
register("format-time", 2, FormatDate.class, BuiltInAtomicType.STRING, |
| 116 |
OPT, XSLT | XPATH30, CARD0) |
| 117 |
.arg(0, BuiltInAtomicType.TIME, OPT, null) |
| 118 |
.arg(1, BuiltInAtomicType.STRING, ONE, null); |
| 119 |
|
| 120 |
register("format-time", 5, FormatDate.class, BuiltInAtomicType.STRING, |
| 121 |
OPT, XSLT | XPATH30, CARD0) |
| 122 |
.arg(0, BuiltInAtomicType.TIME, OPT, null) |
| 123 |
.arg(1, BuiltInAtomicType.STRING, ONE, null) |
| 124 |
.arg(2, BuiltInAtomicType.STRING, OPT, null) |
| 125 |
.arg(3, BuiltInAtomicType.STRING, OPT, null) |
| 126 |
.arg(4, BuiltInAtomicType.STRING, OPT, null); |
| 127 |
|
| 128 |
register("generate-id", 0, ContextItemAccessorFunction.class, BuiltInAtomicType.STRING, ONE, XSLT | XPATH30, CITEM | LATE); |
| 129 |
|
| 130 |
register("generate-id", 1, GenerateId_1.class, BuiltInAtomicType.STRING, ONE, XSLT | XPATH30, 0) |
| 131 |
.arg(0, Type.NODE_TYPE, OPT | INS, StringValue.EMPTY_STRING); |
| 132 |
|
| 133 |
register("has-children", 0, ContextItemAccessorFunction.class, BuiltInAtomicType.BOOLEAN, |
| 134 |
ONE, XPATH30, CITEM | LATE); |
| 135 |
|
| 136 |
register("has-children", 1, HasChildren_1.class, BuiltInAtomicType.BOOLEAN, |
| 137 |
OPT, XPATH30, 0) |
| 138 |
.arg(0, AnyNodeTest.getInstance(), OPT | INS, null); |
| 139 |
|
| 140 |
register("head", 1, HeadFn.class, AnyItemType.getInstance(), |
| 141 |
OPT, XPATH30, FILTER) |
| 142 |
.arg(0, AnyItemType.getInstance(), STAR | TRA, null); |
| 143 |
|
| 144 |
register("innermost", 1, Innermost.class, AnyNodeTest.getInstance(), |
| 145 |
STAR, XPATH30, 0) |
| 146 |
.arg(0, AnyNodeTest.getInstance(), STAR | NAV, null); |
| 147 |
|
| 148 |
register("nilled", 0, ContextItemAccessorFunction.class, BuiltInAtomicType.BOOLEAN, OPT, XPATH30, CITEM | LATE); |
| 149 |
|
| 150 |
register("node-name", 0, ContextItemAccessorFunction.class, BuiltInAtomicType.QNAME, OPT, XPATH30, CITEM | LATE); |
| 151 |
|
| 152 |
register("outermost", 1, Outermost.class, AnyNodeTest.getInstance(), STAR, XPATH30, AS_ARG0 | FILTER) |
| 153 |
.arg(0, AnyNodeTest.getInstance(), STAR | TRA, null); |
| 154 |
|
| 155 |
register("parse-xml", 1, ParseXml.class, NodeKindTest.DOCUMENT, OPT, XPATH30, LATE) |
| 156 |
.arg(0, BuiltInAtomicType.STRING, OPT, EMPTY); |
| 157 |
|
| 158 |
register("parse-xml-fragment", 1, ParseXmlFragment.class, NodeKindTest.DOCUMENT, OPT, XPATH30, LATE) |
| 159 |
.arg(0, BuiltInAtomicType.STRING, OPT, EMPTY); |
| 160 |
|
| 161 |
register("path", 0, ContextItemAccessorFunction.class, BuiltInAtomicType.STRING, OPT, XPATH30, CITEM | LATE); |
| 162 |
|
| 163 |
register("path", 1, Path_1.class, BuiltInAtomicType.STRING, OPT, XPATH30, 0) |
| 164 |
.arg(0, AnyNodeTest.getInstance(), OPT | NAV, null); |
| 165 |
|
| 166 |
register("round", 2, Round.class, NumericType.getInstance(), OPT, XPATH30, AS_PRIM_ARG0) |
| 167 |
.arg(0, NumericType.getInstance(), OPT, EMPTY) |
| 168 |
.arg(1, BuiltInAtomicType.INTEGER, ONE, null); |
| 169 |
|
| 170 |
register("serialize", 1, Serialize.class, BuiltInAtomicType.STRING, ONE, XPATH30, 0) |
| 171 |
.arg(0, AnyItemType.getInstance(), STAR, null); |
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
register("sort", 1, Sort_1.class, AnyItemType.getInstance(), STAR, XPATH31, 0) |
| 178 |
.arg(0, AnyItemType.getInstance(), STAR, null); |
| 179 |
|
| 180 |
register("string-join", 1, StringJoin.class, BuiltInAtomicType.STRING, ONE, XPATH30, 0) |
| 181 |
.arg(0, BuiltInAtomicType.ANY_ATOMIC, STAR, StringValue.EMPTY_STRING); |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
register("tail", 1, TailFn.class, AnyItemType.getInstance(), STAR, XPATH30, AS_ARG0 | FILTER) |
| 188 |
.arg(0, AnyItemType.getInstance(), STAR | TRA, null); |
| 189 |
|
| 190 |
register("unparsed-text", 1, UnparsedText.class, |
| 191 |
BuiltInAtomicType.STRING, OPT, XSLT | XPATH30, BASE | LATE) |
| 192 |
.arg(0, BuiltInAtomicType.STRING, OPT, null); |
| 193 |
|
| 194 |
register("unparsed-text", 2, UnparsedText.class, |
| 195 |
BuiltInAtomicType.STRING, OPT, XSLT | XPATH30, BASE | LATE) |
| 196 |
.arg(0, BuiltInAtomicType.STRING, OPT, null) |
| 197 |
.arg(1, BuiltInAtomicType.STRING, ONE, null); |
| 198 |
|
| 199 |
register("unparsed-text-available", 1, UnparsedTextAvailable.class, |
| 200 |
BuiltInAtomicType.BOOLEAN, ONE, XSLT | XPATH30, BASE | LATE) |
| 201 |
.arg(0, BuiltInAtomicType.STRING, OPT, BooleanValue.FALSE); |
| 202 |
|
| 203 |
register("unparsed-text-available", 2, UnparsedTextAvailable.class, |
| 204 |
BuiltInAtomicType.BOOLEAN, ONE, XSLT | XPATH30, BASE | LATE) |
| 205 |
.arg(0, BuiltInAtomicType.STRING, OPT, BooleanValue.FALSE) |
| 206 |
.arg(1, BuiltInAtomicType.STRING, ONE, null); |
| 207 |
|
| 208 |
register("unparsed-text-lines", 1, UnparsedTextLines.class, BuiltInAtomicType.STRING, STAR, XPATH30, BASE | LATE) |
| 209 |
.arg(0, BuiltInAtomicType.STRING, OPT, null); |
| 210 |
|
| 211 |
register("unparsed-text-lines", 2, UnparsedTextLines.class, BuiltInAtomicType.STRING, STAR, XPATH30, BASE | LATE) |
| 212 |
.arg(0, BuiltInAtomicType.STRING, OPT, null) |
| 213 |
.arg(1, BuiltInAtomicType.STRING, ONE, null); |
| 214 |
|
| 215 |
register("uri-collection", 0, UriCollection.class, BuiltInAtomicType.ANY_URI, STAR, XPATH30, LATE); |
| 216 |
|
| 217 |
register("uri-collection", 1, UriCollection.class, BuiltInAtomicType.ANY_URI, STAR, XPATH30, LATE) |
| 218 |
.arg(0, BuiltInAtomicType.STRING, OPT, null); |
| 219 |
|
| 220 |
|
| 221 |
} |
| 222 |
|
| 223 |
|
| 224 |
} |