Esempio n. 1
0
		public XsltCompiledContext (XslTransformProcessor p) : base (new NameTable ())
		{
			this.p = p;
			scopes = new XsltContextInfo [10];
			for (int i = 0; i < 10; i++)
				scopes [i] = new XsltContextInfo ();
		}
Esempio n. 2
0
		public BaseIterator SortedSelect (XslTransformProcessor p)
		{
			if (isSorterContextDependent) {
				for (int i = 0; i < sorters.Length; i++)
					if (sorterTemplates [i].IsContextDependent)
						sorters [i] = sorterTemplates [i].ToXPathSorter (p);
			}
			BaseIterator iter = (BaseIterator) p.Select (select);
			p.PushNodeset (iter);
			p.PushForEachContext ();
			ArrayList list = new ArrayList (iter.Count);
			while (iter.MoveNext ()) {
				XPathSortElement item = new XPathSortElement ();
				item.Navigator = iter.Current.Clone ();
				item.Values = new object [sorters.Length];
				for (int i = 0; i < sorters.Length; i++)
					item.Values [i] = sorters [i].Evaluate (iter);
				list.Add (item);
			}
			p.PopForEachContext ();
			p.PopNodeset ();

			sortRunner.CopyFrom (sorters);
			return sortRunner.Sort (list, iter.NamespaceManager);
		}
Esempio n. 3
0
 public XsltCompiledContext(XslTransformProcessor p) : base(new NameTable())
 {
     this.p      = p;
     this.scopes = new XsltCompiledContext.XsltContextInfo[10];
     for (int i = 0; i < 10; i++)
     {
         this.scopes[i] = new XsltCompiledContext.XsltContextInfo();
     }
 }
Esempio n. 4
0
 public XPathSorter ToXPathSorter(XslTransformProcessor p)
 {
     return(new XPathSorter(expr,
                            orderAvt == null ? order : ParseOrder(orderAvt.Evaluate(p)),
                            caseOrderAvt == null ? caseOrder: ParseCaseOrder(caseOrderAvt.Evaluate(p)),
                            langAvt == null ? lang : ParseLang(langAvt.Evaluate(p)),
                            dataTypeAvt == null ? dataType : ParseDataType(dataTypeAvt.Evaluate(p))
                            ));
 }
Esempio n. 5
0
 public void DebugExecute(XslTransformProcessor p, XPathNavigator style)
 {
     this.on_execute.Invoke(this.impl, new object[]
     {
         p.CurrentNodeset.Clone(),
         style.Clone(),
         p.XPathContext
     });
 }
Esempio n. 6
0
 public void AddToExpr(XPathExpression e, XslTransformProcessor p)
 {
     e.AddSort(
         expr,
         orderAvt == null ? order : ParseOrder(orderAvt.Evaluate(p)),
         caseOrderAvt == null ? caseOrder: ParseCaseOrder(caseOrderAvt.Evaluate(p)),
         langAvt == null ? lang : ParseLang(langAvt.Evaluate(p)),
         dataTypeAvt == null ? dataType : ParseDataType(dataTypeAvt.Evaluate(p))
         );
 }
 public override void Evaluate(XslTransformProcessor p, Hashtable withParams)
 {
     if (p.CurrentNode.NodeType == XPathNodeType.Whitespace)
     {
         if (p.PreserveOutputWhitespace)
         {
             p.Out.WriteWhitespace(p.CurrentNode.Value);
         }
     }
     else
     {
         p.Out.WriteString(p.CurrentNode.Value);
     }
 }
Esempio n. 8
0
 public XslLocalVariable Resolve(XslTransformProcessor p, XmlQualifiedName name)
 {
     for (VariableScope variableScope = this; variableScope != null; variableScope = variableScope.Parent)
     {
         if (variableScope.variables != null)
         {
             XslLocalVariable xslLocalVariable = variableScope.variables[name] as XslLocalVariable;
             if (xslLocalVariable != null && xslLocalVariable.IsEvaluated(p))
             {
                 return(xslLocalVariable);
             }
         }
     }
     return(null);
 }
Esempio n. 9
0
        private Uri Resolve(string thisUri, string baseUri, XslTransformProcessor p)
        {
            XmlResolver resolver = p.Resolver;

            if (resolver == null)
            {
                return(null);
            }
            Uri baseUri2 = null;

            if (!object.ReferenceEquals(baseUri, XsltDocument.VoidBaseUriFlag) && baseUri != string.Empty)
            {
                baseUri2 = resolver.ResolveUri(null, baseUri);
            }
            return(resolver.ResolveUri(baseUri2, thisUri));
        }
Esempio n. 10
0
 public XslLocalVariable Resolve(XslTransformProcessor p, QName name)
 {
     for (VariableScope s = this; s != null; s = s.Parent)
     {
         if (s.variables == null)
         {
             continue;
         }
         XslLocalVariable v = s.variables [name] as XslLocalVariable;
         if (v != null && v.IsEvaluated(p))
         {
             return(v);
         }
     }
     return(null);
 }
        void EvaluateCore(XslTransformProcessor p, Hashtable withParams)
        {
            if (XslTransform.TemplateStackFrameOutput != null)
            {
                XslTransform.TemplateStackFrameOutput.WriteLine(LocationMessage);
            }

            p.PushStack(stackSize);

            if (parameters != null)
            {
                if (withParams == null)
                {
                    int len = parameters.Count;
                    for (int i = 0; i < len; i++)
                    {
                        XslLocalParam param = (XslLocalParam)parameters [i];
                        param.Evaluate(p);
                    }
                }
                else
                {
                    int len = parameters.Count;
                    for (int i = 0; i < len; i++)
                    {
                        XslLocalParam param = (XslLocalParam)parameters [i];
                        object        o     = withParams [param.Name];
                        if (o != null)
                        {
                            param.Override(p, o);
                        }
                        else
                        {
                            param.Evaluate(p);
                        }
                    }
                }
            }

            if (content != null)
            {
                content.Evaluate(p);
            }

            p.PopStack();
        }
Esempio n. 12
0
 public XslTemplate FindMatch(XPathNavigator node, XslTransformProcessor p)
 {
     if (!this.sorted)
     {
         this.unnamedTemplates.Sort();
         this.unnamedTemplates.Reverse();
         this.sorted = true;
     }
     for (int i = 0; i < this.unnamedTemplates.Count; i++)
     {
         XslModedTemplateTable.TemplateWithPriority templateWithPriority = (XslModedTemplateTable.TemplateWithPriority) this.unnamedTemplates[i];
         if (templateWithPriority.Matches(node, p))
         {
             return(templateWithPriority.Template);
         }
     }
     return(null);
 }
Esempio n. 13
0
        Uri Resolve(string thisUri, string baseUri, XslTransformProcessor p)
        {
//			Debug.WriteLine ("THIS: " + thisUri);
//			Debug.WriteLine ("BASE: " + baseUri);
            XmlResolver r = p.Resolver;

            if (r == null)
            {
                return(null);
            }
            Uri uriBase = null;

            if (!object.ReferenceEquals(baseUri, VoidBaseUriFlag) && baseUri != String.Empty)
            {
                uriBase = r.ResolveUri(null, baseUri);
            }

            return(r.ResolveUri(uriBase, thisUri));
        }
Esempio n. 14
0
 private void EvaluateCore(XslTransformProcessor p, Hashtable withParams)
 {
     if (XslTransform.TemplateStackFrameOutput != null)
     {
         XslTransform.TemplateStackFrameOutput.WriteLine(this.LocationMessage);
     }
     p.PushStack(this.stackSize);
     if (this.parameters != null)
     {
         if (withParams == null)
         {
             int count = this.parameters.Count;
             for (int i = 0; i < count; i++)
             {
                 XslLocalParam xslLocalParam = (XslLocalParam)this.parameters[i];
                 xslLocalParam.Evaluate(p);
             }
         }
         else
         {
             int count2 = this.parameters.Count;
             for (int j = 0; j < count2; j++)
             {
                 XslLocalParam xslLocalParam2 = (XslLocalParam)this.parameters[j];
                 object        obj            = withParams[xslLocalParam2.Name];
                 if (obj != null)
                 {
                     xslLocalParam2.Override(p, obj);
                 }
                 else
                 {
                     xslLocalParam2.Evaluate(p);
                 }
             }
         }
     }
     if (this.content != null)
     {
         this.content.Evaluate(p);
     }
     p.PopStack();
 }
Esempio n. 15
0
 public XslTemplate FindMatch(XPathNavigator node, XmlQualifiedName mode, XslTransformProcessor p)
 {
     if (this[mode] != null)
     {
         XslTemplate xslTemplate = this[mode].FindMatch(node, p);
         if (xslTemplate != null)
         {
             return(xslTemplate);
         }
     }
     for (int i = this.parent.Imports.Count - 1; i >= 0; i--)
     {
         XslStylesheet xslStylesheet = (XslStylesheet)this.parent.Imports[i];
         XslTemplate   xslTemplate   = xslStylesheet.Templates.FindMatch(node, mode, p);
         if (xslTemplate != null)
         {
             return(xslTemplate);
         }
     }
     return(null);
 }
        public XslTemplate FindMatch(XPathNavigator node, XslTransformProcessor p)
        {
            //Debug.WriteLine ("...");
            if (!sorted)
            {
                unnamedTemplates.Sort();
                unnamedTemplates.Reverse();

                sorted = true;
            }

            for (int i = 0; i < unnamedTemplates.Count; i++)
            {
                TemplateWithPriority t = (TemplateWithPriority)unnamedTemplates [i];
                if (t.Matches(node, p))
                {
                    return(t.Template);
                }
            }

            return(null);
        }
Esempio n. 17
0
 public virtual void Evaluate(XslTransformProcessor p, Hashtable withParams)
 {
     if (XslTransform.TemplateStackFrameError)
     {
         try {
             EvaluateCore(p, withParams);
         } catch (XsltException ex) {
             AppendTemplateFrame(ex);
             throw ex;
         } catch (Exception ex) {
             // Note that this catch causes different
             // type of error to be thrown (esp.
             // this causes NUnit test regression).
             XsltException e = new XsltException("Error during XSLT processing: ", null, p.CurrentNode);
             AppendTemplateFrame(e);
             throw e;
         }
     }
     else
     {
         EvaluateCore(p, withParams);
     }
 }
 public bool Matches(XPathNavigator n, XslTransformProcessor p)
 {
     //Debug.WriteLine (Pattern.ToString ());
     return(p.Matches(Pattern, n));
 }
Esempio n. 19
0
		public virtual void Evaluate (XslTransformProcessor p, Hashtable withParams)
		{
			if (XslTransform.TemplateStackFrameError) {
				try {
					EvaluateCore (p, withParams);
				} catch (XsltException ex) {
					AppendTemplateFrame (ex);
					throw ex;
				} catch (Exception) {
					// Note that this catch causes different
					// type of error to be thrown (esp.
					// this causes NUnit test regression).
					XsltException e = new XsltException ("Error during XSLT processing: ", null, p.CurrentNode);
					AppendTemplateFrame (e);
					throw e;
				}
			}
			else
				EvaluateCore (p, withParams);
		}
 public override void Evaluate(XslTransformProcessor p, Hashtable withParams)
 {
     p.ApplyTemplates(p.CurrentNode.SelectChildren(XPathNodeType.All), mode, null);
 }
 public void Evaluate(XslTransformProcessor p)
 {
     Evaluate(p, null);
 }
Esempio n. 22
0
		void EvaluateCore (XslTransformProcessor p, Hashtable withParams)
		{
			if (XslTransform.TemplateStackFrameOutput != null)
				XslTransform.TemplateStackFrameOutput.WriteLine (LocationMessage);

			p.PushStack (stackSize);

			if (parameters != null) {
				if (withParams == null) {
					int len = parameters.Count;
					for (int i = 0; i < len; i++) {
						XslLocalParam param = (XslLocalParam)parameters [i];
						param.Evaluate (p);
					}
				} else {
					int len = parameters.Count;
					for (int i = 0; i < len; i++) {
						XslLocalParam param = (XslLocalParam)parameters [i];
						object o = withParams [param.Name];
						if (o != null)
							param.Override (p, o);
						else
							param.Evaluate (p);
					}
				}
			}
			
			if (content != null)
				content.Evaluate (p);

			p.PopStack ();
		}
Esempio n. 23
0
		public override void Evaluate (XslTransformProcessor p, Hashtable withParams)
		{
			if (p.CurrentNode.NodeType == XPathNodeType.Whitespace) {
				if (p.PreserveOutputWhitespace)
					p.Out.WriteWhitespace (p.CurrentNode.Value);
			}
			else
				p.Out.WriteString (p.CurrentNode.Value);
		}
Esempio n. 24
0
		public override void Evaluate (XslTransformProcessor p) {
			p.SetBusy (this);
			
			if (usedAttributeSets != null) {
				for (int i = 0; i < usedAttributeSets.Count; i++) {
					QName set = (QName) usedAttributeSets [i];
					XslAttributeSet s = p.ResolveAttributeSet (set);
					if (s == null)
						throw new XsltException ("Could not resolve attribute set", null, p.CurrentNode);
					
					if (p.IsBusy (s))
						throw new XsltException ("circular dependency", null, p.CurrentNode);
					
					s.Evaluate (p);
				}
			}
						
			for (int i = 0; i < attributes.Count; i++)
				((XslAttribute) attributes [i]).Evaluate (p);
			
			p.SetFree (this);
		}
Esempio n. 25
0
		public void DebugExecute (XslTransformProcessor p, XPathNavigator style)
		{
			on_execute.Invoke (impl, new object [] {p.CurrentNodeset.Clone (), style.Clone (), p.XPathContext});
		}
Esempio n. 26
0
		public XPathSorter ToXPathSorter (XslTransformProcessor p)
		{
			return new XPathSorter (expr, 
				orderAvt == null ? order : ParseOrder (orderAvt.Evaluate (p)),
				caseOrderAvt == null ? caseOrder: ParseCaseOrder (caseOrderAvt.Evaluate (p)),
				langAvt == null ? lang : ParseLang (langAvt.Evaluate (p)),
				dataTypeAvt == null ? dataType : ParseDataType (dataTypeAvt.Evaluate (p))
			);
		}
Esempio n. 27
0
		public void AddToExpr (XPathExpression e, XslTransformProcessor p)
		{
			e.AddSort (
				expr,
				orderAvt == null ? order : ParseOrder (orderAvt.Evaluate (p)),
				caseOrderAvt == null ? caseOrder: ParseCaseOrder (caseOrderAvt.Evaluate (p)),
				langAvt == null ? lang : ParseLang (langAvt.Evaluate (p)),
				dataTypeAvt == null ? dataType : ParseDataType (dataTypeAvt.Evaluate (p))
			);
		}
Esempio n. 28
0
 public XPathSorter ToXPathSorter(XslTransformProcessor p)
 {
     return(new XPathSorter(this.expr, (this.orderAvt != null) ? this.ParseOrder(this.orderAvt.Evaluate(p)) : this.order, (this.caseOrderAvt != null) ? this.ParseCaseOrder(this.caseOrderAvt.Evaluate(p)) : this.caseOrder, (this.langAvt != null) ? this.ParseLang(this.langAvt.Evaluate(p)) : this.lang, (this.dataTypeAvt != null) ? this.ParseDataType(this.dataTypeAvt.Evaluate(p)) : this.dataType));
 }
Esempio n. 29
0
		public override void Evaluate (XslTransformProcessor p, Hashtable withParams)
		{
			p.ApplyTemplates (p.CurrentNode.SelectChildren (XPathNodeType.All), mode, null);
		}
Esempio n. 30
0
		public override void Evaluate (XslTransformProcessor p, Hashtable withParams)
		{
		}
Esempio n. 31
0
		public XslTemplate FindMatch (XPathNavigator node, XmlQualifiedName mode, XslTransformProcessor p)
		{	
			XslTemplate ret;
			
			if (this [mode] != null)
			{
				ret =  this [mode].FindMatch (node, p);
				if (ret != null) return ret;
			}
			
			for (int i = parent.Imports.Count - 1; i >= 0; i--)
			{
				XslStylesheet s = (XslStylesheet)parent.Imports [i];
				ret = s.Templates.FindMatch (node, mode, p);
				if (ret != null)
					return ret;
			}
			
			return null;
		}
Esempio n. 32
0
		public XslTemplate FindMatch (XPathNavigator node, XslTransformProcessor p)
		{
			//Debug.WriteLine ("...");
			if (!sorted) {
				unnamedTemplates.Sort ();
				unnamedTemplates.Reverse ();
				
				sorted = true;
			}
			
			for (int i = 0; i < unnamedTemplates.Count; i++) {
				TemplateWithPriority t = (TemplateWithPriority) unnamedTemplates [i];
				if (t.Matches (node, p))
					return t.Template;
			}

			return null;
		}
Esempio n. 33
0
		public void Evaluate (XslTransformProcessor p)
		{
			Evaluate (p, null);
		}
		Uri Resolve (string thisUri, string baseUri, XslTransformProcessor p)
		{
//			Debug.WriteLine ("THIS: " + thisUri);
//			Debug.WriteLine ("BASE: " + baseUri);
			XmlResolver r = p.Resolver;
			if (r == null)
				return null;
			Uri uriBase = null;
			if (! object.ReferenceEquals (baseUri, VoidBaseUriFlag) && baseUri != String.Empty)
				uriBase = r.ResolveUri (null, baseUri);
				
			return r.ResolveUri (uriBase, thisUri);
		}
Esempio n. 35
0
			public bool Matches (XPathNavigator n, XslTransformProcessor p)
			{
				//Debug.WriteLine (Pattern.ToString ());
				return p.Matches (Pattern, n);
			}
Esempio n. 36
0
 public bool Matches(XPathNavigator n, XslTransformProcessor p)
 {
     return(p.Matches(this.Pattern, n));
 }
Esempio n. 37
0
		public XslLocalVariable Resolve (XslTransformProcessor p, QName name)
		{
			for (VariableScope s = this; s != null; s = s.Parent) {
				if (s.variables == null) continue;
				XslLocalVariable v = s.variables [name] as XslLocalVariable;
				if (v != null && v.IsEvaluated (p))
					return v;

			}
			return null;
		}
Esempio n. 38
0
 public override void Evaluate(XslTransformProcessor p, Hashtable withParams)
 {
 }
Esempio n. 39
0
 public void AddToExpr(XPathExpression e, XslTransformProcessor p)
 {
     e.AddSort(this.expr, (this.orderAvt != null) ? this.ParseOrder(this.orderAvt.Evaluate(p)) : this.order, (this.caseOrderAvt != null) ? this.ParseCaseOrder(this.caseOrderAvt.Evaluate(p)) : this.caseOrder, (this.langAvt != null) ? this.ParseLang(this.langAvt.Evaluate(p)) : this.lang, (this.dataTypeAvt != null) ? this.ParseDataType(this.dataTypeAvt.Evaluate(p)) : this.dataType);
 }