Update of /cvsroot/mvp-xml/EXSLT/v2/src/Exslt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27047/v2/src/Exslt Modified Files: Exslt.csproj ExsltContext.cs ExsltDatesAndTimes.cs ExsltMath.cs ExsltNamespaces.cs ExsltStrings.cs ExsltTransform.cs Makefile Log Message: Index: ExsltNamespaces.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/ExsltNamespaces.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ExsltNamespaces.cs 29 Oct 2005 21:14:35 -0000 1.2 +++ ExsltNamespaces.cs 30 Oct 2005 13:50:54 -0000 1.3 @@ -2,18 +2,30 @@ /// <summary> /// Exslt (and other) namespaces constants. /// </summary> - public static class ExsltNamespaces { + public static class ExsltNamespaces { + /// <summary>EXSLT Dates and Times module namespace</summary> public const string DatesAndTimes = "http://exslt.org/dates-and-times"; + /// <summary>EXSLT Math module namespace</summary> public const string Math = "http://exslt.org/math"; + /// <summary>EXSLT Random module namespace</summary> public const string Random = "http://exslt.org/random"; + /// <summary>EXSLT Regexp module namespace</summary> public const string RegularExpressions = "http://exslt.org/regular-expressions"; + /// <summary>EXSLT Sets module namespace</summary> public const string Sets = "http://exslt.org/sets"; + /// <summary>EXSLT Strings module namespace</summary> public const string Strings = "http://exslt.org/strings"; + /// <summary>GotDotNet Dates and Times module namespace</summary> public const string GDNDatesAndTimes = "http://gotdotnet.com/exslt/dates-and-times"; + /// <summary>GotDotNet Math module namespace</summary> public const string GDNMath = "http://gotdotnet.com/exslt/math"; + /// <summary>GotDotNet Regexp module namespace</summary> public const string GDNRegularExpressions = "http://gotdotnet.com/exslt/regular-expressions"; + /// <summary>GotDotNet Sets module namespace</summary> public const string GDNSets = "http://gotdotnet.com/exslt/sets"; + /// <summary>GotDotNet Strings module namespace</summary> public const string GDNStrings = "http://gotdotnet.com/exslt/strings"; + /// <summary>GotDotNet Dynamic module namespace</summary> public const string GDNDynamic = "http://gotdotnet.com/exslt/dynamic"; } } \ No newline at end of file Index: ExsltMath.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/ExsltMath.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ExsltMath.cs 29 Oct 2005 21:14:35 -0000 1.2 +++ ExsltMath.cs 30 Oct 2005 13:50:54 -0000 1.3 @@ -236,8 +236,7 @@ /// <summary> /// Implements the following function /// number constant(string, number) - /// </summary> - /// <param name="number"></param> + /// </summary> /// <returns>The specified constant or NaN</returns> /// <remarks>This method only supports the constants /// E and PI. Also the precision parameter is ignored.</remarks> @@ -267,8 +266,7 @@ /// <summary> /// Implements the following function /// number random() - /// </summary> - /// <param name="x"></param> + /// </summary> /// <returns></returns> public double random() { Index: ExsltStrings.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/ExsltStrings.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ExsltStrings.cs 16 Oct 2005 20:07:08 -0000 1.1 +++ ExsltStrings.cs 30 Oct 2005 13:50:54 -0000 1.2 @@ -1,302 +1,316 @@ #region Using using System; -using System.Xml.XPath; +using System.Xml.XPath; using System.Xml; using System.Text; using System.Text.RegularExpressions; using System.Web; #endregion -namespace Mvp.Xml.Exslt +namespace Mvp.Xml.Exslt { - /// <summary> - /// Implements the functions in the http://exslt.org/strings namespace - /// </summary> - public class ExsltStrings { - private readonly static char[] hexdigit = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; + /// <summary> + /// Implements the functions in the http://exslt.org/strings namespace + /// </summary> + public class ExsltStrings + { + private readonly static char[] hexdigit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; #region tokenize() - /// <summary> - /// Implements the following function - /// node-set tokenize(string, string) - /// </summary> - /// <param name="str"></param> - /// <param name="delimiters"></param> - /// <param name="flags"></param> - /// <returns>This function breaks the input string into a sequence of strings, - /// treating any character in the list of delimiters as a separator. - /// The separators themselves are not returned. - /// The tokens are returned as a set of 'token' elements.</returns> - public XPathNodeIterator tokenize(string str, string delimiters) - { + /// <summary> + /// Implements the following function + /// node-set tokenize(string, string) + /// </summary> + /// <param name="str"></param> + /// <param name="delimiters"></param> + /// <returns>This function breaks the input string into a sequence of strings, + /// treating any character in the list of delimiters as a separator. + /// The separators themselves are not returned. + /// The tokens are returned as a set of 'token' elements.</returns> + public XPathNodeIterator tokenize(string str, string delimiters) + { - XmlDocument doc = new XmlDocument(); - doc.LoadXml("<tokens/>"); - - if (delimiters == String.Empty) + XmlDocument doc = new XmlDocument(); + doc.LoadXml("<tokens/>"); + + if (delimiters == String.Empty) { - foreach (char c in str) + foreach (char c in str) { - XmlElement elem = doc.CreateElement("token"); - elem.InnerText = c.ToString(); - doc.DocumentElement.AppendChild(elem); + XmlElement elem = doc.CreateElement("token"); + elem.InnerText = c.ToString(); + doc.DocumentElement.AppendChild(elem); } - } - else - { - foreach(string token in str.Split(delimiters.ToCharArray())) + } + else + { + foreach (string token in str.Split(delimiters.ToCharArray())) { - - XmlElement elem = doc.CreateElement("token"); - elem.InnerText = token; - doc.DocumentElement.AppendChild(elem); + + XmlElement elem = doc.CreateElement("token"); + elem.InnerText = token; + doc.DocumentElement.AppendChild(elem); } } - return doc.CreateNavigator().Select("//token"); - } + return doc.CreateNavigator().Select("//token"); + } - /// <summary> - /// Implements the following function - /// node-set tokenize(string) - /// </summary> - /// <param name="str"></param> - /// <param name="delimiters"></param> - /// <param name="flags"></param> - /// <returns>This function breaks the input string into a sequence of strings, - /// using the whitespace characters as a delimiter. - /// The separators themselves are not returned. - /// The tokens are returned as a set of 'token' elements.</returns> - public XPathNodeIterator tokenize(string str){ + /// <summary> + /// Implements the following function + /// node-set tokenize(string) + /// </summary> + /// <param name="str"></param> + /// <returns>This function breaks the input string into a sequence of strings, + /// using the whitespace characters as a delimiter. + /// The separators themselves are not returned. + /// The tokens are returned as a set of 'token' elements.</returns> + public XPathNodeIterator tokenize(string str) + { - Regex regex = new Regex("\\s+"); + Regex regex = new Regex("\\s+"); - XmlDocument doc = new XmlDocument(); - doc.LoadXml("<tokens/>"); - - foreach(string token in regex.Split(str)){ - - XmlElement elem = doc.CreateElement("token"); - elem.InnerText = token; - doc.DocumentElement.AppendChild(elem); - } + XmlDocument doc = new XmlDocument(); + doc.LoadXml("<tokens/>"); - return doc.CreateNavigator().Select("//token"); - } + foreach (string token in regex.Split(str)) + { + + XmlElement elem = doc.CreateElement("token"); + elem.InnerText = token; + doc.DocumentElement.AppendChild(elem); + } + + return doc.CreateNavigator().Select("//token"); + } #endregion #region replace() -/// <summary> -/// Implements the following function -/// string replace(string, string, string) -/// </summary> -/// <param name="str"></param> -/// <param name="oldValue"></param> -/// <param name="newValue"></param> -/// <returns></returns> -/// <remarks>This function has completely diffeerent semantics from the EXSLT function. -/// The description of the EXSLT function is confusing and furthermore no one has implemented -/// the described semantics which implies that others find the method problematic. Instead -/// this function is straightforward, it replaces all occurrences of oldValue with -/// newValue</remarks> - public string replace(string str, string oldValue, string newValue) + /// <summary> + /// Implements the following function + /// string replace(string, string, string) + /// </summary> + /// <param name="str"></param> + /// <param name="oldValue"></param> + /// <param name="newValue"></param> + /// <returns></returns> + /// <remarks>This function has completely diffeerent semantics from the EXSLT function. + /// The description of the EXSLT function is confusing and furthermore no one has implemented + /// the described semantics which implies that others find the method problematic. Instead + /// this function is straightforward, it replaces all occurrences of oldValue with + /// newValue</remarks> + public string replace(string str, string oldValue, string newValue) { - return str.Replace(oldValue, newValue); - } + return str.Replace(oldValue, newValue); + } #endregion #region padding() -/// <summary> -/// Implements the following function -/// string padding(number) -/// </summary> -/// <param name="number"></param> -/// <returns></returns> - public string padding(int number) { - string s = String.Empty; - - if(number < 0){ - return s; - }else{ - return s.PadLeft(number); - } - } - - /// <summary> - /// Implements the following function - /// string padding(number, string) - /// </summary> - /// <param name="number"></param> - /// <returns></returns> - public string padding(int number, string s) - { + /// <summary> + /// Implements the following function + /// string padding(number) + /// </summary> + /// <param name="number"></param> + /// <returns></returns> + public string padding(int number) + { + string s = String.Empty; - if(number < 0 || s == string.Empty) - { - return String.Empty; - } - else - { - StringBuilder sb = new StringBuilder(s); - - while(sb.Length < number) - { - sb.Append(s); + if (number < 0) + { + return s; + } + else + { + return s.PadLeft(number); + } } - if(sb.Length > number) - { - return sb.Remove(number, sb.Length - number).ToString(); - } - else + /// <summary> + /// Implements the following function + /// string padding(number, string) + /// </summary> + public string padding(int number, string s) { - return sb.ToString(); + + if (number < 0 || s == string.Empty) + { + return String.Empty; + } + else + { + StringBuilder sb = new StringBuilder(s); + + while (sb.Length < number) + { + sb.Append(s); + } + + if (sb.Length > number) + { + return sb.Remove(number, sb.Length - number).ToString(); + } + else + { + return sb.ToString(); + } + } } - } - } #endregion #region split() - /// <summary> - /// Implements the following function - /// node-set split(string) - /// </summary> - /// <param name="str"></param> - /// <remarks>This function breaks the input string into a sequence of strings, - /// using the space character as a delimiter. - /// The space character itself is never returned not even when there are - /// adjacent space characters. - /// </remarks> - /// <returns>The tokens are returned as a set of 'token' elements</returns> - public XPathNodeIterator split(string str) + /// <summary> + /// Implements the following function + /// node-set split(string) + /// </summary> + /// <param name="str"></param> + /// <remarks>This function breaks the input string into a sequence of strings, + /// using the space character as a delimiter. + /// The space character itself is never returned not even when there are + /// adjacent space characters. + /// </remarks> + /// <returns>The tokens are returned as a set of 'token' elements</returns> + public XPathNodeIterator split(string str) { - - XmlDocument doc = new XmlDocument(); - doc.LoadXml("<tokens/>"); - - foreach(string match in str.Split(new char[]{' '})){ - - if(!match.Equals(String.Empty)){ - XmlElement elem = doc.CreateElement("token"); - elem.InnerText = match; - doc.DocumentElement.AppendChild(elem); - } - } + XmlDocument doc = new XmlDocument(); + doc.LoadXml("<tokens/>"); - return doc.CreateNavigator().Select("//token"); - } + foreach (string match in str.Split(new char[] { ' ' })) + { - /// <summary> - /// Implements the following function - /// node-set split(string, string) - /// </summary> - /// <param name="str"></param> - /// <param name="delimiter"></param> - /// <remarks>This function breaks the input string into a sequence of strings, - /// using the space character as a delimiter. - /// The space character itself is never returned not even when there are - /// adjacent space characters. - /// </remarks> - /// <returns>The tokens are returned as a set of 'token' elements</returns> - public XPathNodeIterator split(string str, string delimiter){ - - XmlDocument doc = new XmlDocument(); - doc.LoadXml("<tokens/>"); - + if (!match.Equals(String.Empty)) + { + XmlElement elem = doc.CreateElement("token"); + elem.InnerText = match; + doc.DocumentElement.AppendChild(elem); + } + } - if(delimiter.Equals(String.Empty)){ - foreach(char match in str){ - - XmlElement elem = doc.CreateElement("token"); - elem.InnerText = match.ToString(); - doc.DocumentElement.AppendChild(elem); - } - }else{ - //since there is no String.Split(string) method we use the Regex class - //and escape special characters. - //. $ ^ { [ ( | ) * + ? \ - delimiter = delimiter.Replace("\\","\\\\").Replace("$", "\\$").Replace("^", "\\^"); - delimiter = delimiter.Replace("{", "\\{").Replace("[", "\\[").Replace("(", "\\("); - delimiter = delimiter.Replace("*","\\*").Replace(")", "\\)").Replace("|", "\\|"); - delimiter = delimiter.Replace("+", @"\+").Replace("?", "\\?").Replace(".", "\\."); - - Regex regex = new Regex(delimiter); + return doc.CreateNavigator().Select("//token"); + } - foreach(string match in regex.Split(str)){ - - if((!match.Equals(String.Empty)) && (!match.Equals(delimiter))){ - XmlElement elem = doc.CreateElement("token"); - elem.InnerText = match; - doc.DocumentElement.AppendChild(elem); - } - } - } + /// <summary> + /// Implements the following function + /// node-set split(string, string) + /// </summary> + /// <param name="str"></param> + /// <param name="delimiter"></param> + /// <remarks>This function breaks the input string into a sequence of strings, + /// using the space character as a delimiter. + /// The space character itself is never returned not even when there are + /// adjacent space characters. + /// </remarks> + /// <returns>The tokens are returned as a set of 'token' elements</returns> + public XPathNodeIterator split(string str, string delimiter) + { - return doc.CreateNavigator().Select("//token"); - } + XmlDocument doc = new XmlDocument(); + doc.LoadXml("<tokens/>"); + + + if (delimiter.Equals(String.Empty)) + { + foreach (char match in str) + { + + XmlElement elem = doc.CreateElement("token"); + elem.InnerText = match.ToString(); + doc.DocumentElement.AppendChild(elem); + } + } + else + { + //since there is no String.Split(string) method we use the Regex class + //and escape special characters. + //. $ ^ { [ ( | ) * + ? \ + delimiter = delimiter.Replace("\\", "\\\\").Replace("$", "\\$").Replace("^", "\\^"); + delimiter = delimiter.Replace("{", "\\{").Replace("[", "\\[").Replace("(", "\\("); + delimiter = delimiter.Replace("*", "\\*").Replace(")", "\\)").Replace("|", "\\|"); + delimiter = delimiter.Replace("+", @"\+").Replace("?", "\\?").Replace(".", "\\."); + + Regex regex = new Regex(delimiter); + + + foreach (string match in regex.Split(str)) + { + + if ((!match.Equals(String.Empty)) && (!match.Equals(delimiter))) + { + XmlElement elem = doc.CreateElement("token"); + elem.InnerText = match; + doc.DocumentElement.AppendChild(elem); + } + } + } + + return doc.CreateNavigator().Select("//token"); + } #endregion #region concat() - /// <summary> - /// Implements the following function - /// string concat(node-set) - /// </summary> - /// <param name="nodeset"></param> - /// <returns></returns> - public string concat(XPathNodeIterator nodeset) + /// <summary> + /// Implements the following function + /// string concat(node-set) + /// </summary> + /// <param name="nodeset"></param> + /// <returns></returns> + public string concat(XPathNodeIterator nodeset) { - StringBuilder sb = new StringBuilder(); - - while(nodeset.MoveNext()){ - sb.Append(nodeset.Current.Value); - } + StringBuilder sb = new StringBuilder(); - return sb.ToString(); - } + while (nodeset.MoveNext()) + { + sb.Append(nodeset.Current.Value); + } + + return sb.ToString(); + } #endregion - + #region align() - /// <summary> - /// Implements the following function - /// string str:align(string, string, string) - /// </summary> - /// <param name="str">String to align</param> - /// <param name="padding">String, within which to align</param> - /// <param name="alignment">left/right/center</param> - /// <returns>Aligned string.</returns> - public string align(string str, string padding, string alignment) + /// <summary> + /// Implements the following function + /// string str:align(string, string, string) + /// </summary> + /// <param name="str">String to align</param> + /// <param name="padding">String, within which to align</param> + /// <param name="alignment">left/right/center</param> + /// <returns>Aligned string.</returns> + public string align(string str, string padding, string alignment) { - if (str.Length > padding.Length) - return str.Substring(0, padding.Length); - else if (str.Length == padding.Length) - return str; - else { - switch (alignment) { - case "right": - return padding.Substring(0, padding.Length - str.Length) + str; - case "center": - int space = (padding.Length - str.Length)/2; - return padding.Substring(0, space) + str + - padding.Substring(str.Length + space); - default: - //Align to left by default - return str + padding.Substring(str.Length); - } - } - } - + if (str.Length > padding.Length) + return str.Substring(0, padding.Length); + else if (str.Length == padding.Length) + return str; + else + { + switch (alignment) + { + case "right": + return padding.Substring(0, padding.Length - str.Length) + str; + case "center": + int space = (padding.Length - str.Length) / 2; + return padding.Substring(0, space) + str + + padding.Substring(str.Length + space); + default: + //Align to left by default + return str + padding.Substring(str.Length); + } + } + } + /// <summary> /// Implements the following function /// string str:align(string, string) @@ -304,9 +318,10 @@ /// <param name="str">String to align</param> /// <param name="padding">String, within which to align</param> /// <returns>Aligned to left string.</returns> - public string align(string str, string padding) { + public string align(string str, string padding) + { return align(str, padding, "left"); - } + } #endregion @@ -352,20 +367,20 @@ /// <param name="encoding">A character encoding to use</param> /// <returns>The encoded string</returns> public string encodeUri(string str, bool encodeReserved, string encoding) - { + { Encoding enc = null; - try + try { enc = Encoding.GetEncoding(encoding); - } - catch + } + catch { //Not supported encoding, return empty string return String.Empty; } return encodeUriImpl(str, encodeReserved, enc); } - + /// <summary> /// Implements the following function /// string str:encode-uri(string, string, string) @@ -373,31 +388,38 @@ /// <param name="str">String to encode</param> /// <param name="encodeReserved">If true, will encode even the /// [RFC 2396] and [RFC 2732] "reserved characters"</param> - /// <param name="encoding">A character encoding to use</param> + /// <param name="enc">A character encoding to use</param> /// <returns>The encoded string</returns> private string encodeUriImpl(string str, bool encodeReserved, Encoding enc) { if (str == string.Empty) - return str; + return str; StringBuilder res = new StringBuilder(str.Length); char[] chars = str.ToCharArray(); - if (encodeReserved) + if (encodeReserved) { - for (int i=0; i<chars.Length; i++) + for (int i = 0; i < chars.Length; i++) { char c = chars[i]; - if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9')) + if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) res.Append(c); - else + else { - switch (c) + switch (c) { - case '-':case '_':case '.':case '!':case '~':case '*': - case '\'':case '(':case ')': + case '-': + case '_': + case '.': + case '!': + case '~': + case '*': + case '\'': + case '(': + case ')': res.Append(c); break; case '%': - if (i<chars.Length-2 && IsHexDigit(chars[i+1]) && IsHexDigit(chars[i+2])) + if (i < chars.Length - 2 && IsHexDigit(chars[i + 1]) && IsHexDigit(chars[i + 2])) res.Append(c); else EncodeChar(res, enc, chars, i); @@ -408,26 +430,43 @@ } } } - } - else + } + else { - for (int i=0; i<chars.Length; i++) + for (int i = 0; i < chars.Length; i++) { char c = chars[i]; - if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9')) + if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) res.Append(c); - else + else { - switch (c) + switch (c) { - case '-':case '_':case '.':case '!':case '~':case '*': - case '\'':case '(':case ')':case ';':case '/':case '?': - case ':':case '@':case '&':case '=':case '+':case '$': - case ',':case '[':case ']': + case '-': + case '_': + case '.': + case '!': + case '~': + case '*': + case '\'': + case '(': + case ')': + case ';': + case '/': + case '?': + case ':': + case '@': + case '&': + case '=': + case '+': + case '$': + case ',': + case '[': + case ']': res.Append(c); break; case '%': - if (i<chars.Length-2 && IsHexDigit(chars[i+1]) && IsHexDigit(chars[i+2])) + if (i < chars.Length - 2 && IsHexDigit(chars[i + 1]) && IsHexDigit(chars[i + 2])) res.Append(c); else EncodeChar(res, enc, chars, i); @@ -439,19 +478,19 @@ } } - } + } return res.ToString(); } - private void EncodeChar(StringBuilder res, Encoding enc, char[] str, int index) + private void EncodeChar(StringBuilder res, Encoding enc, char[] str, int index) { foreach (byte b in enc.GetBytes(str, index, 1)) - res.AppendFormat("%{0}{1}", hexdigit[b>>4], hexdigit[b&15]); + res.AppendFormat("%{0}{1}", hexdigit[b >> 4], hexdigit[b & 15]); } - - private bool IsHexDigit(char c) + + private bool IsHexDigit(char c) { - return (c>='0' && c<='9') || (c>='a' && c<='f') || (c>='A' && c<='F'); + return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } #endregion @@ -493,19 +532,19 @@ /// <param name="encoding">A character encoding to use</param> /// <returns>The decoded string</returns> public string decodeUri(string str, string encoding) - { + { if (encoding == String.Empty) return String.Empty; Encoding enc = null; - try + try { enc = Encoding.GetEncoding(encoding); - } - catch + } + catch { //Not supported encoding, return empty string - return String.Empty; - } + return String.Empty; + } return decodeUriImpl(str, enc); } @@ -514,14 +553,14 @@ /// string str:decode-uri(string, string) /// </summary> /// <param name="str">String to decode</param> - /// <param name="encoding">A character encoding to use</param> + /// <param name="enc">A character encoding to use</param> /// <returns>The decoded string</returns> private string decodeUriImpl(string str, Encoding enc) { if (str == string.Empty) - return str; - return HttpUtility.UrlDecode(str, enc); + return str; + return HttpUtility.UrlDecode(str, enc); } #endregion - } + } } \ No newline at end of file Index: Exslt.csproj =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/Exslt.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Exslt.csproj 29 Oct 2005 21:14:35 -0000 1.2 +++ Exslt.csproj 30 Oct 2005 13:50:54 -0000 1.3 @@ -55,7 +55,7 @@ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> <ConfigurationOverrideFile> </ConfigurationOverrideFile> - <DefineConstants>TRACE;NET11</DefineConstants> + <DefineConstants>TRACE</DefineConstants> <DocumentationFile> </DocumentationFile> <DebugSymbols>false</DebugSymbols> Index: Makefile =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile 29 Oct 2005 21:14:35 -0000 1.2 +++ Makefile 30 Oct 2005 13:50:54 -0000 1.3 @@ -10,7 +10,7 @@ @echo ########### Renaming methods... MethodRenamer.exe Mvp.Xml.Exslt.il Mvp.Xml.Exslt.Fixed.il @echo ########### Assembling library back... - ilasm Mvp.Xml.Exslt.Fixed.il /RESOURCE=Mvp.Xml.Exslt.res /DLL /OUTPUT=Mvp.Xml.Exslt.dll /KEY=../../../../Global/v1/mvp-xml.snk + ilasm Mvp.Xml.Exslt.Fixed.il /RESOURCE=Mvp.Xml.Exslt.res /DLL /OUTPUT=Mvp.Xml.Exslt.dll /KEY=../../../../Global/mvp-xml.snk nmake clean clean: Index: ExsltDatesAndTimes.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/ExsltDatesAndTimes.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ExsltDatesAndTimes.cs 29 Oct 2005 21:14:35 -0000 1.2 +++ ExsltDatesAndTimes.cs 30 Oct 2005 13:50:54 -0000 1.3 @@ -18,7 +18,7 @@ { private CultureInfo ci = new CultureInfo("en-US"); - internal protected class ExsltDateTimeFactory + private class ExsltDateTimeFactory { /// <summary> /// Parse a date and time for format-date() @@ -115,7 +115,7 @@ } } - internal protected abstract class ExsltDateTime + internal abstract class ExsltDateTime { public DateTime d; public TimeSpan ts = new TimeSpan(TimeSpan.MinValue.Ticks); @@ -287,7 +287,7 @@ protected abstract string outputFormat {get;} } - internal protected class DateTimeTZ : ExsltDateTime + internal class DateTimeTZ : ExsltDateTime { public DateTimeTZ() : base(){} public DateTimeTZ(string inS) : base(inS){} @@ -313,7 +313,7 @@ } - internal protected class DateTZ : ExsltDateTime + internal class DateTZ : ExsltDateTime { public DateTZ() : base(){} public DateTZ(string inS) : base(inS){} @@ -341,7 +341,7 @@ } } - internal protected class TimeTZ : ExsltDateTime + internal class TimeTZ : ExsltDateTime { public TimeTZ(string inS) : base(inS){} public TimeTZ() : base(){} @@ -368,7 +368,7 @@ } } - internal protected class YearMonth : ExsltDateTime + internal class YearMonth : ExsltDateTime { public YearMonth() : base(){} public YearMonth(string inS) : base(inS){} @@ -395,7 +395,7 @@ } } - internal protected class YearTZ : ExsltDateTime + internal class YearTZ : ExsltDateTime { public YearTZ() : base(){} public YearTZ(string inS) : base(inS){} @@ -423,7 +423,7 @@ } } - internal protected class Month : ExsltDateTime + internal class Month : ExsltDateTime { public Month() : base(){} public Month(string inS) : base(inS){} @@ -451,7 +451,7 @@ } } - internal protected class Day : ExsltDateTime + internal class Day : ExsltDateTime { public Day() : base(){} public Day(string inS) : base(inS){} @@ -479,7 +479,7 @@ } } - internal protected class MonthDay : ExsltDateTime + internal class MonthDay : ExsltDateTime { public MonthDay() : base(){} public MonthDay(string inS) : base(inS){} @@ -582,7 +582,7 @@ /// </summary> /// <returns>The formtted date and time as a ISO8601 string</returns> - protected string dateTimeImpl(DateTimeTZ dtz) + internal string dateTimeImpl(DateTimeTZ dtz) { return dtz.ToString(); } @@ -1007,7 +1007,7 @@ /// number date:day-in-week(string) /// </summary> /// <returns>The day in the week of the specified date or NaN if the - /// date is invalid. <returns>The current day in the week. 1=Sunday, 2=Monday,...,7=Saturday + /// date is invalid. The current day in the week. 1=Sunday, 2=Monday,...,7=Saturday /// </returns> public double dayInWeek(string d){ try @@ -1359,7 +1359,11 @@ { return dayAbbreviation((int)DateTime.Now.DayOfWeek); } - + + /// <summary> + /// This wrapper method will be renamed during custom build + /// to provide conformant EXSLT function name. + /// </summary> public string dayAbbreviation_RENAME_ME() { return dayAbbreviation(); @@ -1510,7 +1514,7 @@ /// Implements the following function /// string date:format-date(string, string) /// </summary> - /// <param name="date">The date to format</param> + /// <param name="d">The date to format</param> /// <param name="format">One of the format strings understood by the /// Java 1.1 SimpleDateFormat method: /// @@ -1518,7 +1522,7 @@ ///------ ------- ------------ ------- ///G era designator (Text) AD ///y year (Number) 1996 - ///M month in year (Text & Number) July & 07 + ///M month in year (Text & Number) July & 07 ///d day in month (Number) 10 ///h hour in am/pm (1~12) (Number) 12 ///H hour in day (0~23) (Number) 0 @@ -1825,7 +1829,7 @@ /// string date:parse-date(string, string) /// BUGBUG: should use Java formatting strings, not Windows. /// </summary> - /// <param name="date">The date to parse</param> + /// <param name="d">The date to parse</param> /// <param name="format">One of the format strings understood by the /// DateTime.ToString(string) method.</param> /// <returns>The parsed date</returns> @@ -2042,8 +2046,8 @@ /// Implements the following function /// string:date:add-duration(string, string) /// </summary> - /// <param name="datetime">A date/time</param> - /// <param name="duration">the duration to add</param> + /// <param name="duration1">Initial duration</param> + /// <param name="duration2">the duration to add</param> /// <returns>The new time</returns> public string addDuration(string duration1, string duration2) { Index: ExsltTransform.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/ExsltTransform.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ExsltTransform.cs 29 Oct 2005 21:14:35 -0000 1.2 +++ ExsltTransform.cs 30 Oct 2005 13:50:54 -0000 1.3 @@ -19,20 +19,35 @@ [Flags] public enum ExsltFunctionNamespace { + /// <summary>Nothing</summary> None = 0, + /// <summary>Dates and Times module</summary> DatesAndTimes = 1, + /// <summary>Math module</summary> Math = 2, + /// <summary>RegExp module</summary> RegularExpressions = 4, + /// <summary>Sets module</summary> Sets = 8, + /// <summary>Strings module</summary> Strings = 16, + /// <summary>GotDotNet Dates and Times module</summary> GDNDatesAndTimes = 32, + /// <summary>GotDotNet Sets module</summary> GDNSets = 64, + /// <summary>GotDotNet Math module</summary> GDNMath = 128, + /// <summary>GotDotNet RegExp module</summary> GDNRegularExpressions = 256, + /// <summary>GotDotNet Strings module</summary> GDNStrings = 512, + /// <summary>Random module</summary> Random = 1024, + /// <summary>GotDotNet Dynamic module</summary> GDNDynamic = 2056, + /// <summary>All EXSLT modules</summary> AllExslt = DatesAndTimes | Math | Random | RegularExpressions | Sets | Strings, + /// <summary>All modules</summary> All = DatesAndTimes | Math | Random | RegularExpressions | Sets | Strings | GDNDatesAndTimes | GDNSets | GDNMath | GDNRegularExpressions | GDNStrings | GDNDynamic } Index: ExsltContext.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/ExsltContext.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ExsltContext.cs 29 Oct 2005 21:14:35 -0000 1.3 +++ ExsltContext.cs 30 Oct 2005 13:50:54 -0000 1.4 @@ -10,338 +10,354 @@ namespace Mvp.Xml.Exslt { - /// <summary> - /// Custom XsltContext for resolving EXSLT functions in - /// XPath-only environment. - /// </summary> - public class ExsltContext : XsltContext - { + /// <summary> + /// Custom XsltContext for resolving EXSLT functions in + /// XPath-only environment. + /// </summary> + public class ExsltContext : XsltContext + { - #region Private Fields and Properties + #region Private Fields and Properties - private XmlNameTable _nt; + private XmlNameTable _nt; - /// <summary> - /// Bitwise enumeration used to specify which EXSLT functions should be accessible to - /// in the ExsltContext object. The default value is ExsltFunctionNamespace.All - /// </summary> - private ExsltFunctionNamespace _supportedFunctions = ExsltFunctionNamespace.All; + /// <summary> + /// Bitwise enumeration used to specify which EXSLT functions should be accessible to + /// in the ExsltContext object. The default value is ExsltFunctionNamespace.All + /// </summary> + private ExsltFunctionNamespace _supportedFunctions = ExsltFunctionNamespace.All; - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/math namespace - /// </summary> - private ExsltMath exsltMath = new ExsltMath(); + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/math namespace + /// </summary> + private ExsltMath exsltMath = new ExsltMath(); - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/dates-and-times namespace - /// </summary> - private ExsltDatesAndTimes exsltDatesAndTimes = new ExsltDatesAndTimes(); + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/dates-and-times namespace + /// </summary> + private ExsltDatesAndTimes exsltDatesAndTimes = new ExsltDatesAndTimes(); - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/regular-expressions namespace - /// </summary> - private ExsltRegularExpressions exsltRegularExpressions = new ExsltRegularExpressions(); + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/regular-expressions namespace + /// </summary> + private ExsltRegularExpressions exsltRegularExpressions = new ExsltRegularExpressions(); - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/strings namespace - /// </summary> - private ExsltStrings exsltStrings = new ExsltStrings(); + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/strings namespace + /// </summary> + private ExsltStrings exsltStrings = new ExsltStrings(); - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/sets namespace - /// </summary> - private ExsltSets exsltSets = new ExsltSets(); + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/sets namespace + /// </summary> + private ExsltSets exsltSets = new ExsltSets(); - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/random namespace - /// </summary> - private ExsltRandom exsltRandom = new ExsltRandom(); + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/random namespace + /// </summary> + private ExsltRandom exsltRandom = new ExsltRandom(); - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/dates-and-times namespace - /// </summary> - private GDNDatesAndTimes gdnDatesAndTimes = new GDNDatesAndTimes(); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/dates-and-times namespace + /// </summary> + private GDNDatesAndTimes gdnDatesAndTimes = new GDNDatesAndTimes(); - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/regular-expressions namespace - /// </summary> - private GDNRegularExpressions gdnRegularExpressions = new GDNRegularExpressions(); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/regular-expressions namespace + /// </summary> + private GDNRegularExpressions gdnRegularExpressions = new GDNRegularExpressions(); - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/math namespace - /// </summary> - private GDNMath gdnMath = new GDNMath(); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/math namespace + /// </summary> + private GDNMath gdnMath = new GDNMath(); - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/sets namespace - /// </summary> - private GDNSets gdnSets = new GDNSets(); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/sets namespace + /// </summary> + private GDNSets gdnSets = new GDNSets(); - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/strings namespace - /// </summary> - private GDNStrings gdnStrings = new GDNStrings(); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/strings namespace + /// </summary> + private GDNStrings gdnStrings = new GDNStrings(); - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/dynamic namespace - /// </summary> - private GDNDynamic gdnDynamic = new GDNDynamic(); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/dynamic namespace + /// </summary> + private GDNDynamic gdnDynamic = new GDNDynamic(); - #endregion + #endregion - #region Constructors + #region Constructors - public ExsltContext(XmlNameTable nt) - : base((NameTable)nt) - { - _nt = nt; - AddExtensionNamespaces(); - } + /// <summary> + /// Creates new ExsltContext instance. + /// </summary> + public ExsltContext(XmlNameTable nt) + : base((NameTable)nt) + { + _nt = nt; + AddExtensionNamespaces(); + } - public ExsltContext(NameTable nt, ExsltFunctionNamespace supportedFunctions) - : this(nt) - { - SupportedFunctions = supportedFunctions; - } + /// <summary> + /// Creates new ExsltContext instance. + /// </summary> + public ExsltContext(NameTable nt, ExsltFunctionNamespace supportedFunctions) + : this(nt) + { + SupportedFunctions = supportedFunctions; + } - #endregion + #endregion - #region Private methods - private void AddExtensionNamespaces() - { - //remove all our extension objects in case the ExsltContext is being reused - RemoveNamespace("math", ExsltNamespaces.Math); - RemoveNamespace("date", ExsltNamespaces.DatesAndTimes); - RemoveNamespace("regexp", ExsltNamespaces.RegularExpressions); - RemoveNamespace("str", ExsltNamespaces.Strings); - RemoveNamespace("set", ExsltNamespaces.Sets); - RemoveNamespace("random", ExsltNamespaces.Random); - RemoveNamespace("date2", ExsltNamespaces.GDNDatesAndTimes); - RemoveNamespace("math2", ExsltNamespaces.GDNMath); - RemoveNamespace("regexp2", ExsltNamespaces.GDNRegularExpressions); - RemoveNamespace("set2", ExsltNamespaces.GDNSets); - RemoveNamespace("str2", ExsltNamespaces.GDNStrings); - RemoveNamespace("dyn2", ExsltNamespaces.GDNDynamic); + #region Private methods + private void AddExtensionNamespaces() + { + //remove all our extension objects in case the ExsltContext is being reused + RemoveNamespace("math", ExsltNamespaces.Math); + RemoveNamespace("date", ExsltNamespaces.DatesAndTimes); + RemoveNamespace("regexp", ExsltNamespaces.RegularExpressions); + RemoveNamespace("str", ExsltNamespaces.Strings); + RemoveNamespace("set", ExsltNamespaces.Sets); + RemoveNamespace("random", ExsltNamespaces.Random); + RemoveNamespace("date2", ExsltNamespaces.GDNDatesAndTimes); + RemoveNamespace("math2", ExsltNamespaces.GDNMath); + RemoveNamespace("regexp2", ExsltNamespaces.GDNRegularExpressions); + RemoveNamespace("set2", ExsltNamespaces.GDNSets); + RemoveNamespace("str2", ExsltNamespaces.GDNStrings); + RemoveNamespace("dyn2", ExsltNamespaces.GDNDynamic); - //add extension objects as specified by SupportedFunctions - if ((this.SupportedFunctions & ExsltFunctionNamespace.Math) > 0) - AddNamespace("math", ExsltNamespaces.Math); + //add extension objects as specified by SupportedFunctions + if ((this.SupportedFunctions & ExsltFunctionNamespace.Math) > 0) + AddNamespace("math", ExsltNamespaces.Math); - if ((this.SupportedFunctions & ExsltFunctionNamespace.DatesAndTimes) > 0) - AddNamespace("date", ExsltNamespaces.DatesAndTimes); + if ((this.SupportedFunctions & ExsltFunctionNamespace.DatesAndTimes) > 0) + AddNamespace("date", ExsltNamespaces.DatesAndTimes); - if ((this.SupportedFunctions & ExsltFunctionNamespace.RegularExpressions) > 0) - AddNamespace("regexp", ExsltNamespaces.RegularExpressions); + if ((this.SupportedFunctions & ExsltFunctionNamespace.RegularExpressions) > 0) + AddNamespace("regexp", ExsltNamespaces.RegularExpressions); - if ((this.SupportedFunctions & ExsltFunctionNamespace.Strings) > 0) - AddNamespace("str", ExsltNamespaces.Strings); + if ((this.SupportedFunctions & ExsltFunctionNamespace.Strings) > 0) + AddNamespace("str", ExsltNamespaces.Strings); - if ((this.SupportedFunctions & ExsltFunctionNamespace.Sets) > 0) - AddNamespace("set", ExsltNamespaces.Sets); + if ((this.SupportedFunctions & ExsltFunctionNamespace.Sets) > 0) + AddNamespace("set", ExsltNamespaces.Sets); - if ((this.SupportedFunctions & ExsltFunctionNamespace.Random) > 0) - AddNamespace("random", ExsltNamespaces.Random); + if ((this.SupportedFunctions & ExsltFunctionNamespace.Random) > 0) + AddNamespace("random", ExsltNamespaces.Random); - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNDatesAndTimes) > 0) - AddNamespace("date2", ExsltNamespaces.GDNDatesAndTimes); + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNDatesAndTimes) > 0) + AddNamespace("date2", ExsltNamespaces.GDNDatesAndTimes); - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNMath) > 0) - AddNamespace("math2", ExsltNamespaces.GDNMath); + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNMath) > 0) + AddNamespace("math2", ExsltNamespaces.GDNMath); - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNRegularExpressions) > 0) - AddNamespace("regexp2", ExsltNamespaces.GDNRegularExpressions); + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNRegularExpressions) > 0) + AddNamespace("regexp2", ExsltNamespaces.GDNRegularExpressions); - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNSets) > 0) - AddNamespace("set2", ExsltNamespaces.GDNSets); + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNSets) > 0) + AddNamespace("set2", ExsltNamespaces.GDNSets); - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNStrings) > 0) - AddNamespace("str2", ExsltNamespaces.GDNStrings); + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNStrings) > 0) + AddNamespace("str2", ExsltNamespaces.GDNStrings); - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNDynamic) > 0) - AddNamespace("dyn2", ExsltNamespaces.GDNDynamic); - } - #endregion + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNDynamic) > 0) + AddNamespace("dyn2", ExsltNamespaces.GDNDynamic); + } + #endregion - #region Public Properties - /// <summary> - /// Bitwise enumeration used to specify which EXSLT functions should be accessible to - /// in the ExsltContext. The default value is ExsltFunctionNamespace.All - /// </summary> - public ExsltFunctionNamespace SupportedFunctions - { - set - { - if (Enum.IsDefined(typeof(ExsltFunctionNamespace), value)) - _supportedFunctions = value; - } - get { return _supportedFunctions; } - } - #endregion + #region Public Properties + /// <summary> + /// Bitwise enumeration used to specify which EXSLT functions should be accessible to + /// in the ExsltContext. The default value is ExsltFunctionNamespace.All + /// </summary> + public ExsltFunctionNamespace SupportedFunctions + { + set + { + if (Enum.IsDefined(typeof(ExsltFunctionNamespace), value)) + _supportedFunctions = value; + } + get { return _supportedFunctions; } + } + #endregion - #region XsltContext Overrides - public override int CompareDocument(string baseUri, string nextbaseUri) - { - return 0; - } + #region XsltContext Overrides - public override bool PreserveWhitespace(XPathNavigator node) - { - return true; - } + /// <summary> + /// See <see cref="XsltContext.CompareDocument"/> + /// </summary> + public override int CompareDocument(string baseUri, string nextbaseUri) + { + return 0; + } - public override bool Whitespace - { - get { return true; } - } + /// <summary> + /// See <see cref="XsltContext.PreserveWhitespace"/> + /// </summary> + public override bool PreserveWhitespace(XPathNavigator node) + { + return true; + } - /// <summary> - /// Resolves variables. - /// </summary> - /// <param name="prefix">The variable's prefix</param> - /// <param name="name">The variable's name</param> - /// <returns></returns> - public override IXsltContextVariable ResolveVariable(string prefix, string name) - { - return null; - } + /// <summary> + /// See <see cref="XsltContext.Whitespace"/> + /// </summary> + public override bool Whitespace + { + get { return true; } + } - /// <summary> - /// Resolves custom function in XPath expression. - /// </summary> - /// <param name="prefix">The prefix of the function as it appears in the XPath expression.</param> - /// <param name="name">The name of the function.</param> - /// <param name="argTypes">An array of argument types for the function being resolved. - /// This allows you to select between methods with the same name (for example, overloaded - /// methods). </param> - /// <returns>An IXsltContextFunction representing the function.</returns> - public override IXsltContextFunction ResolveFunction(string prefix, string name, - XPathResultType[] argTypes) - { - switch (LookupNamespace(_nt.Get(prefix))) - { - case ExsltNamespaces.DatesAndTimes: - return GetExtensionFunctionImplementation(exsltDatesAndTimes, name, argTypes); - case ExsltNamespaces.Math: - return GetExtensionFunctionImplementation(exsltMath, name, argTypes); - case ExsltNamespaces.RegularExpressions: - return GetExtensionFunctionImplementation(exsltRegularExpressions, name, argTypes); - case ExsltNamespaces.Sets: - return GetExtensionFunctionImplementation(exsltSets, name, argTypes); - case ExsltNamespaces.Strings: - return GetExtensionFunctionImplementation(exsltStrings, name, argTypes); - case ExsltNamespaces.Random: - return GetExtensionFunctionImplementation(exsltRandom, name, argTypes); - case ExsltNamespaces.GDNDatesAndTimes: - return GetExtensionFunctionImplementation(gdnDatesAndTimes, name, argTypes); - case ExsltNamespaces.GDNMath: - return GetExtensionFunctionImplementation(gdnMath, name, argTypes); - case ExsltNamespaces.GDNRegularExpressions: - return GetExtensionFunctionImplementation(gdnRegularExpressions, name, argTypes); - case ExsltNamespaces.GDNSets: - return GetExtensionFunctionImplementation(gdnSets, name, argTypes); - case ExsltNamespaces.GDNStrings: - return GetExtensionFunctionImplementation(gdnStrings, name, argTypes); - case ExsltNamespaces.GDNDynamic: - return GetExtensionFunctionImplementation(gdnDynamic, name, argTypes); - default: - throw new XPathException(string.Format("Unrecognized extension function namespace: prefix='{0}', namespace URI='{1}'", - prefix, LookupNamespace(_nt.Get(prefix))), null); - } - } - #endregion + /// <summary> + /// Resolves variables. + /// </summary> + /// <param name="prefix">The variable's prefix</param> + /// <param name="name">The variable's name</param> + /// <returns></returns> + public override IXsltContextVariable ResolveVariable(string prefix, string name) + { + return null; + } - /// <summary> - /// Finds appropriate implementation for an extension function - public - /// method with the same number of arguments and compatible argument types. - /// </summary> - /// <param name="obj">Extension object</param> - /// <param name="name">Function name</param> - /// <param name="argTypes">Types of arguments</param> - /// <returns></returns> - private ExsltContextFunction GetExtensionFunctionImplementation(object obj, string name, XPathResultType[] argTypes) - { - //For each method in object's type - foreach (MethodInfo mi in obj.GetType().GetMethods()) - { - //We are interested in methods with given name - if (mi.Name == name) + /// <summary> + /// Resolves custom function in XPath expression. + /// </summary> + /// <param name="prefix">The prefix of the function as it appears in the XPath expression.</param> + /// <param name="name">The name of the function.</param> + /// <param name="argTypes">An array of argument types for the function being resolved. + /// This allows you to select between methods with the same name (for example, overloaded + /// methods). </param> + /// <returns>An IXsltContextFunction representing the function.</returns> + public override IXsltContextFunction ResolveFunction(string prefix, string name, + XPathResultType[] argTypes) { - ParameterInfo[] parameters = mi.GetParameters(); - ////We are interested in methods with g... [truncated message content] |