public override void Evaluate(XslTransformProcessor p) { if (p.Debugger != null) { p.Debugger.DebugExecute(p, this.DebugInput); } if (children == null) { return; } XPathNodeIterator iter = sortEvaluator != null? sortEvaluator.SortedSelect(p) : p.Select(select); while (p.NodesetMoveNext(iter)) { p.PushNodeset(iter); p.PushForEachContext(); children.Evaluate(p); p.PopForEachContext(); p.PopNodeset(); } }
public override void Evaluate(XslTransformProcessor p) { if (p.Debugger != null) { p.Debugger.DebugExecute(p, this.DebugInput); } // This intelligent optimization causes poor compatibility bug shown in bug #457065 // if (children == null) // return; XPathNodeIterator iter = sortEvaluator != null? sortEvaluator.SortedSelect(p) : p.Select(select); while (p.NodesetMoveNext(iter)) { p.PushNodeset(iter); p.PushForEachContext(); children.Evaluate(p); p.PopForEachContext(); p.PopNodeset(); } }
public override void Evaluate(XslTransformProcessor p) { if (p.Debugger != null) { p.Debugger.DebugExecute(p, this.DebugInput); } children.Evaluate(p); }
public bool EvaluateIfTrue(XslTransformProcessor p) { if (p.EvaluateBoolean(test)) { if (children != null) { children.Evaluate(p); } return(true); } return(false); }
public override void Evaluate(XslTransformProcessor p) { if (p.Debugger != null) { p.Debugger.DebugExecute(p, this.DebugInput); } // Since namespace-alias might be determined after compilation // of import-ing stylesheets, this must be determined later. bool isCData = p.InsideCDataElement; p.PushElementState(prefix, localname, nsUri, true); p.Out.WriteStartElement(prefix, localname, nsUri); if (useAttributeSets != null) { foreach (XmlQualifiedName s in useAttributeSets) { p.ResolveAttributeSet(s).Evaluate(p); } } if (attrs != null) { int len = attrs.Count; for (int i = 0; i < len; i++) { ((XslLiteralAttribute)attrs [i]).Evaluate(p); } } p.OutputLiteralNamespaceUriNodes(nsDecls, null, null); if (children != null) { children.Evaluate(p); } var templateContent = children as XslTemplateContent; if (isEmptyElement || (templateContent != null && templateContent.IsEmptyElement)) { p.Out.WriteEndElement(); } else { p.Out.WriteFullEndElement(); } p.PopCDataState(isCData); }
public object Evaluate(XslTransformProcessor p) { if (select != null) { object o = p.Evaluate(select); // To resolve variable references correctly, we // have to collect all the target nodes here. // (otherwise, variables might be resolved with // different level of variable stack in // XslTransformProcessor). if (o is XPathNodeIterator) { ArrayList al = new ArrayList(); XPathNodeIterator iter = (XPathNodeIterator)o; while (iter.MoveNext()) { al.Add(iter.Current.Clone()); } o = new ListIterator(al, p.XPathContext); } return(o); } else if (content != null) { // XmlNodeWriter w = new XmlNodeWriter (false); // DTMXPathDocumentWriter w = new DTMXPathDocumentWriter (p.CurrentNode.NameTable, 200); DTMXPathDocumentWriter2 w = new DTMXPathDocumentWriter2(p.CurrentNode.NameTable, 200); Outputter outputter = new GenericOutputter(w, p.Outputs, null, true); p.PushOutput(outputter); content.Evaluate(p); p.PopOutput(); // return w.Document.CreateNavigator ().SelectChildren (XPathNodeType.All); // return w.CreateDocument ().CreateNavigator ().SelectChildren (XPathNodeType.All); // return w.Document.CreateNavigator (); return(w.CreateDocument().CreateNavigator()); } else { return(""); } }
public override void Evaluate(XslTransformProcessor p) { if (p.Debugger != null) { p.Debugger.DebugExecute(p, this.DebugInput); } int len = conditions.Count; for (int i = 0; i < len; i++) { if (((XslIf)conditions [i]).EvaluateIfTrue(p)) { return; } } if (defaultChoice != null) { defaultChoice.Evaluate(p); } }
public override void Evaluate(XslTransformProcessor p) { if (p.Debugger != null) { p.Debugger.DebugExecute(p, this.DebugInput); } XPathNavigator nav = p.CurrentNode; switch (nav.NodeType) { case XPathNodeType.Root: if (p.Out.CanProcessAttributes && useAttributeSets != null) { foreach (XmlQualifiedName s in useAttributeSets) { XslAttributeSet attset = p.ResolveAttributeSet(s); if (attset == null) { throw new XsltException("Attribute set was not found", null, nav); } attset.Evaluate(p); } } if (children != null) { children.Evaluate(p); } break; case XPathNodeType.Element: bool isCData = p.InsideCDataElement; string prefix = nav.Prefix; p.PushElementState(prefix, nav.LocalName, nav.NamespaceURI, true); p.Out.WriteStartElement(prefix, nav.LocalName, nav.NamespaceURI); if (useAttributeSets != null) { foreach (XmlQualifiedName s in useAttributeSets) { p.ResolveAttributeSet(s).Evaluate(p); } } if (nav.MoveToFirstNamespace(XPathNamespaceScope.ExcludeXml)) { do { if (nav.LocalName == prefix) { continue; } p.Out.WriteNamespaceDecl(nav.LocalName, nav.Value); } while (nav.MoveToNextNamespace(XPathNamespaceScope.ExcludeXml)); nav.MoveToParent(); } if (children != null) { children.Evaluate(p); } p.Out.WriteFullEndElement(); p.PopCDataState(isCData); break; case XPathNodeType.Attribute: p.Out.WriteAttributeString(nav.Prefix, nav.LocalName, nav.NamespaceURI, nav.Value); break; case XPathNodeType.SignificantWhitespace: case XPathNodeType.Whitespace: bool cdata = p.Out.InsideCDataSection; p.Out.InsideCDataSection = false; p.Out.WriteString(nav.Value); p.Out.InsideCDataSection = cdata; break; case XPathNodeType.Text: p.Out.WriteString(nav.Value); break; case XPathNodeType.Comment: p.Out.WriteComment(nav.Value); break; case XPathNodeType.ProcessingInstruction: p.Out.WriteProcessingInstruction(nav.Name, nav.Value); break; case XPathNodeType.Namespace: if (p.XPathContext.ElementPrefix != nav.Name) { p.Out.WriteNamespaceDecl(nav.Name, nav.Value); } break; default: // Console.WriteLine ("unhandled node type {0}", nav.NodeType); break; } }
public override void Evaluate(XslTransformProcessor p) { if (p.Debugger != null) { p.Debugger.DebugExecute(p, this.DebugInput); } string nm, nmsp, localName, prefix; localName = nm = calcName != null ? calcName : name.Evaluate(p); nmsp = calcNs != null ? calcNs : ns != null?ns.Evaluate(p) : null; QName q = XslNameUtil.FromString(nm, nsDecls); localName = q.Name; if (nmsp == null) { nmsp = q.Namespace; } int colonAt = nm.IndexOf(':'); if (colonAt > 0) { calcPrefix = nm.Substring(0, colonAt); } else if (colonAt == 0) { // raises an error XmlConvert.VerifyNCName(String.Empty); } prefix = calcPrefix != null ? calcPrefix : String.Empty; if (prefix != String.Empty) { XmlConvert.VerifyNCName(prefix); } XmlConvert.VerifyNCName(localName); bool isCData = p.InsideCDataElement; p.PushElementState(prefix, localName, nmsp, false); p.Out.WriteStartElement(prefix, localName, nmsp); if (useAttributeSets != null) { foreach (XmlQualifiedName s in useAttributeSets) { p.ResolveAttributeSet(s).Evaluate(p); } } if (value != null) { value.Evaluate(p); } if (isEmptyElement && useAttributeSets == null) { p.Out.WriteEndElement(); } else { p.Out.WriteFullEndElement(); } p.PopCDataState(isCData); }