Exemplo n.º 1
0
    public override string LookupNamespace(string prefix)
    {
      if (prefix.Length==0)
 	      return baseContext.LookupNamespace(DefaultNamespacePrefix);
      else
 	      return baseContext.LookupNamespace(prefix);
    }
Exemplo n.º 2
0
 public override string LookupNamespace(string prefix)
 {
     // Must return empty uri for empty prefix, or XPath evaluation will break
     return(string.IsNullOrEmpty(prefix)
                         ? string.Empty
                         : context.LookupNamespace(prefix));
 }
Exemplo n.º 3
0
            public override object Invoke(XsltContext xsltContext, object[] args, XPathNavigator docContext)
            {
                XsltCompileContext xsltCompileContext = (XsltCompileContext)xsltContext;

                string local, prefix;

                PrefixQName.ParseQualifiedName(ToString(args[0]), out prefix, out local);
                string?          ns      = xsltContext.LookupNamespace(prefix);
                XmlQualifiedName keyName = new XmlQualifiedName(local, ns);

                XPathNavigator root = docContext.Clone();

                root.MoveToRoot();

                ArrayList?resultCollection = null;

                foreach (Key key in xsltCompileContext._processor !.KeyList !)
                {
                    if (key.Name == keyName)
                    {
                        Hashtable?keyTable = key.GetKeys(root);
                        if (keyTable == null)
                        {
                            keyTable = xsltCompileContext.BuildKeyTable(key, root);
                            key.AddKey(root, keyTable);
                        }

                        XPathNodeIterator?it = args[1] as XPathNodeIterator;
                        if (it != null)
                        {
                            it = it.Clone();
                            while (it.MoveNext())
                            {
                                resultCollection = AddToList(resultCollection, (ArrayList?)keyTable[it.Current !.Value]);
Exemplo n.º 4
0
 internal override void SetXsltContext(XsltContext context)
 {
     System.Diagnostics.Debug.Assert(context != null);
     m_URN = context.LookupNamespace(m_Prefix);
     if (m_qyInput != null)
     {
         m_qyInput.SetXsltContext(context);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// This method resolves the prefix of an argument.
 /// If a prefix is found, the corresponding namespace URI is looked up
 /// and substituted.
 /// </summary>
 /// <param name="args">An argument of the function to be resolved</param>
 /// <param name="xsltContext">The Xslt context for namespace resolving</param>
 private string ResolveNsPrefix(string args, XsltContext xsltContext)
 {
     if (args.Contains(":"))
     {
         var    prefix = args.Substring(0, args.IndexOf(":", StringComparison.Ordinal));
         string ns;
         if (!string.IsNullOrEmpty((ns = xsltContext.LookupNamespace(prefix))))
         {
             args = args.Replace(prefix + ":", ns);
         }
     }
     return(args);
 }
Exemplo n.º 6
0
            /// <summary>
            /// This method resolves the prefix of an argument.
            /// If a prefix is found, the corresponding namespace URI is looked up
            /// and substituted.
            /// </summary>
            /// <param name="args">An argument of the function to be resolved</param>
            /// <param name="xsltContext">The Xslt context for namespace resolving</param>
            private string resolveNsPrefix(string args, XsltContext xsltContext)
            {
                string prefix;
                string ns;

                if (args.Contains(":"))
                {
                    prefix = args.Substring(0, args.IndexOf(":"));
                    if (!string.IsNullOrEmpty((ns = xsltContext.LookupNamespace(prefix))))
                    {
                        args = args.Replace(prefix + ":", ns);
                    }
                }
                return(args);
            }
Exemplo n.º 7
0
 public override void SetXsltContext(XsltContext context)
 {
     Debug.Assert(context != null);
     _nsUri = context.LookupNamespace(_prefix);
     qyInput.SetXsltContext(context);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Gets the namespace URI for the specified prefix.
 /// </summary>
 /// <param name="prefix">The prefix whose namespace URI you want to resolve. To match the default namespace, pass String.EmptyFalse.</param>
 /// <returns>
 /// Returns the namespace URI for <paramref name="prefix"/> or null if there is no mapped namespace. The returned string is atomized.
 /// For more information on atomized strings, see <see cref="T:System.Xml.XmlNameTable"/>.
 /// </returns>
 public override string LookupNamespace(string prefix)
 {
     return(_baseContext.LookupNamespace(prefix));
 }
 public override void SetXsltContext(XsltContext context)
 {
     this.nsUri = context.LookupNamespace(this.prefix);
     this.qyInput.SetXsltContext(context);
 }
Exemplo n.º 10
0
        public object Evaluate(XsltContext xsltContext)
        {
            var argList = ((XPathContext)xsltContext).ArgList;

            return(argList.GetParam(Name, xsltContext.LookupNamespace(Prefix)));
        }
            public override object Invoke(XsltContext xsltContext, object[] args, XPathNavigator docContext) {
                XsltCompileContext xsltCompileContext = (XsltCompileContext) xsltContext;

                string local, prefix;
                PrefixQName.ParseQualifiedName(ToString(args[0]), out prefix, out local);
                string ns = xsltContext.LookupNamespace(prefix);
                XmlQualifiedName keyName = new XmlQualifiedName(local, ns);

                XPathNavigator root = docContext.Clone();
                root.MoveToRoot();

                ArrayList resultCollection = null;

                foreach (Key key in xsltCompileContext.processor.KeyList) {
                    if (key.Name == keyName) {
                        Hashtable keyTable = key.GetKeys(root);
                        if (keyTable == null) {
                            keyTable = xsltCompileContext.BuildKeyTable(key, root);
                            key.AddKey(root, keyTable);
                        }

                        XPathNodeIterator it = args[1] as XPathNodeIterator;
                        if (it != null) {
                            it = it.Clone();
                            while (it.MoveNext()) {
                                resultCollection = AddToList(resultCollection, (ArrayList) keyTable[it.Current.Value]);
                            }
                        } else {
                            resultCollection = AddToList(resultCollection, (ArrayList) keyTable[ToString(args[1])]);
                        }
                    }
                }
                if (resultCollection == null) {
                    return XPathEmptyIterator.Instance;
                } else if (resultCollection[0] is XPathNavigator) {
                    return new XPathArrayIterator(resultCollection);
                } else {
                    return new XPathMultyIterator(resultCollection);
                }
            }