Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ResolveFunction()

QilNode IXPathEnvironment. System.Xml.Xsl.Xslt.QilGenerator.ResolveFunction ( string prefix,
string name,
IList< QilNode > args,
IFocus env )
inlineprivate

Implements System.Xml.Xsl.XPath.IXPathEnvironment.

Definition at line 2256 of file QilGenerator.cs.

2257 {
2258 if (prefix.Length == 0)
2259 {
2260 if (FunctionTable.TryGetValue(name, out var value))
2261 {
2262 value.CastArguments(args, name, _f);
2263 switch (value.id)
2264 {
2265 case FuncId.Current:
2266 if (!_allowCurrent)
2267 {
2268 throw new XslLoadException(System.SR.Xslt_CurrentNotAllowed);
2269 }
2270 return ((IFocus)this).GetCurrent();
2271 case FuncId.Key:
2272 if (!_allowKey)
2273 {
2274 throw new XslLoadException(System.SR.Xslt_KeyNotAllowed);
2275 }
2276 return CompileFnKey(args[0], args[1], env);
2277 case FuncId.Document:
2278 return CompileFnDocument(args[0], (args.Count > 1) ? args[1] : null);
2279 case FuncId.FormatNumber:
2280 return CompileFormatNumber(args[0], args[1], (args.Count > 2) ? args[2] : null);
2281 case FuncId.UnparsedEntityUri:
2282 return CompileUnparsedEntityUri(args[0]);
2283 case FuncId.GenerateId:
2284 return CompileGenerateId((args.Count > 0) ? args[0] : env.GetCurrent());
2285 case FuncId.SystemProperty:
2286 return CompileSystemProperty(args[0]);
2287 case FuncId.ElementAvailable:
2288 return CompileElementAvailable(args[0]);
2289 case FuncId.FunctionAvailable:
2290 return CompileFunctionAvailable(args[0]);
2291 default:
2292 return null;
2293 }
2294 }
2295 throw new XslLoadException(System.SR.Xslt_UnknownXsltFunction, Compiler.ConstructQName(prefix, name));
2296 }
2298 if (text == "urn:schemas-microsoft-com:xslt")
2299 {
2300 switch (name)
2301 {
2302 case "node-set":
2304 return CompileMsNodeSet(args[0]);
2305 case "string-compare":
2308 case "utc":
2310 return _f.InvokeMsUtc(_f.ConvertToString(args[0]));
2311 case "format-date":
2312 case "format-time":
2314 return _f.InvokeMsFormatDateTime(_f.ConvertToString(args[0]), (1 < args.Count) ? _f.ConvertToString(args[1]) : _f.String(string.Empty), (2 < args.Count) ? _f.ConvertToString(args[2]) : _f.String(string.Empty), _f.Boolean(name == "format-date"));
2315 case "local-name":
2318 case "namespace-uri":
2320 return _f.InvokeMsNamespaceUri(_f.ConvertToString(args[0]), env.GetCurrent());
2321 case "number":
2323 return _f.InvokeMsNumber(args[0]);
2324 }
2325 }
2326 if (text == "http://exslt.org/common")
2327 {
2328 if (name == "node-set")
2329 {
2331 return CompileMsNodeSet(args[0]);
2332 }
2333 if (name == "object-type")
2334 {
2336 return EXslObjectType(args[0]);
2337 }
2338 }
2339 for (int i = 0; i < args.Count; i++)
2340 {
2342 }
2344 {
2346 if (xmlExtensionFunction != null)
2347 {
2349 }
2350 }
2352 {
2355 }
2356 return _f.XsltInvokeLateBound(_f.QName(name, text, prefix), args);
2357 }
static string Xslt_UnknownXsltFunction
Definition SR.cs:1914
static string Xslt_ScriptsProhibited
Definition SR.cs:1986
static string Xslt_CurrentNotAllowed
Definition SR.cs:1982
static string Xslt_KeyNotAllowed
Definition SR.cs:1978
Definition SR.cs:7
QilNode XsltInvokeLateBound(QilNode name, IList< QilNode > args)
QilName QName(string local, string uri, string prefix)
static void CheckArity(int minArgs, int maxArgs, string name, int numArgs)
QilNode Error(string res, QilNode args)
QilNode GenerateScriptCall(QilName name, XmlExtensionFunction scrFunc, IList< QilNode > args)
QilNode CompileFunctionAvailable(QilNode name)
QilNode CompileGenerateId(QilNode n)
readonly XsltQilFactory _f
QilNode CompileElementAvailable(QilNode name)
QilNode CompileUnparsedEntityUri(QilNode n)
QilNode CompileFormatNumber(QilNode value, QilNode formatPicture, QilNode formatName)
static Dictionary< string, XPathBuilder.FunctionInfo< FuncId > > FunctionTable
string ResolvePrefixThrow(bool ignoreDefaultNs, string prefix)
void ReportWarning(string res, params string[] args)
QilNode CompileFnKey(QilNode name, QilNode keys, IFocus env)
QilNode CompileFnDocument(QilNode uris, QilNode baseNode)
QilNode CompileSystemProperty(QilNode name)
QilNode CompileMsNodeSet(QilNode n)
TrimSafeDictionary ScriptClasses
Definition Scripts.cs:50
XmlExtensionFunction ResolveFunction(string name, string ns, int numArgs, IErrorHelper errorHelper)
Definition Scripts.cs:58
ISourceLineInfo SourceLine
Definition XslNode.cs:10
QilNode InvokeMsStringCompare(QilNode x, QilNode y, QilNode lang, QilNode options)
QilNode InvokeMsNamespaceUri(QilNode n, QilNode currentNode)
QilNode InvokeMsFormatDateTime(QilNode datetime, QilNode format, QilNode lang, QilNode isDate)

References System.Xml.Xsl.Xslt.QilGenerator._allowCurrent, System.Xml.Xsl.Xslt.QilGenerator._allowKey, System.Xml.Xsl.Xslt.QilGenerator._compiler, System.Xml.Xsl.Xslt.QilGenerator._f, System.Xml.Xsl.Xslt.QilGenerator._lastScope, System.Xml.Xsl.Qil.QilPatternFactory.Boolean(), System.Xml.Xsl.XPath.XPathBuilder.FunctionInfo< T >.CheckArity(), System.Xml.Xsl.Xslt.QilGenerator.CompileElementAvailable(), System.Xml.Xsl.Xslt.QilGenerator.CompileFnDocument(), System.Xml.Xsl.Xslt.QilGenerator.CompileFnKey(), System.Xml.Xsl.Xslt.QilGenerator.CompileFormatNumber(), System.Xml.Xsl.Xslt.QilGenerator.CompileFunctionAvailable(), System.Xml.Xsl.Xslt.QilGenerator.CompileGenerateId(), System.Xml.Xsl.Xslt.QilGenerator.CompileMsNodeSet(), System.Xml.Xsl.Xslt.QilGenerator.CompileSystemProperty(), System.Xml.Xsl.Xslt.QilGenerator.CompileUnparsedEntityUri(), System.Xml.Xsl.Xslt.Compiler.ConstructQName(), System.Xml.Xsl.Xslt.Scripts.TrimSafeDictionary.ContainsKey(), System.Xml.Xsl.XPath.XPathQilFactory.ConvertToString(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Xsl.XsltSettings.EnableScript, System.Xml.Xsl.XPath.XPathQilFactory.Error(), System.Xml.Xsl.Xslt.QilGenerator.EXslObjectType(), System.Xml.Xsl.Xslt.QilGenerator.FunctionTable, System.Xml.Xsl.Xslt.QilGenerator.GenerateScriptCall(), System.Xml.Xsl.Xslt.XsltQilFactory.InvokeMsFormatDateTime(), System.Xml.Xsl.Xslt.XsltQilFactory.InvokeMsLocalName(), System.Xml.Xsl.Xslt.XsltQilFactory.InvokeMsNamespaceUri(), System.Xml.Xsl.Xslt.XsltQilFactory.InvokeMsNumber(), System.Xml.Xsl.Xslt.XsltQilFactory.InvokeMsStringCompare(), System.Xml.Xsl.Xslt.XsltQilFactory.InvokeMsUtc(), System.prefix, System.Xml.Xsl.Qil.QilPatternFactory.QName(), System.Xml.Xsl.Xslt.QilGenerator.ReportWarning(), System.Xml.Xsl.Xslt.Scripts.ResolveFunction(), System.Xml.Xsl.Xslt.QilGenerator.ResolvePrefixThrow(), System.Xml.Xsl.XPath.XPathQilFactory.SafeDocOrderDistinct(), System.Xml.Xsl.Xslt.Scripts.ScriptClasses, System.Xml.Xsl.Xslt.Compiler.Scripts, System.Xml.Xsl.Xslt.Compiler.Settings, System.Xml.Xsl.Xslt.XslNode.SourceLine, System.Xml.Xsl.Qil.QilPatternFactory.String(), System.text, System.value, System.SR.Xslt_CurrentNotAllowed, System.SR.Xslt_KeyNotAllowed, System.SR.Xslt_ScriptsProhibited, System.SR.Xslt_UnknownXsltFunction, and System.Xml.Xsl.Qil.QilPatternFactory.XsltInvokeLateBound().