public static XmlElement XslForEachGroup(this XmlElement element, XPathExpr selectXPath) { XmlElement copyOfElement = element.XslElement("for-each-group"); copyOfElement.AddAttributeWithValue("select", selectXPath); return(copyOfElement); }
public static XmlElement XslIf(this XmlElement element, XPathExpr test) { XmlElement valueOfElement = element.XslElement("if"); valueOfElement.AddAttributeWithValue("test", test); return(valueOfElement); }
public static XmlElement XslValueOf(this XmlElement element, XPathExpr selectXPath) { XmlElement valueOfElement = element.XslElement("value-of"); valueOfElement.AddAttributeWithValue("select", selectXPath); return(valueOfElement); }
public static XmlElement XslForEach(this XmlElement element, XPathExpr selectXPath) { XmlElement forEachElement = element.XslElement("for-each"); forEachElement.AddAttributeWithValue("select", selectXPath); return(forEachElement); }
public static XmlElement XslCopyOf(this XmlElement element, XPathExpr selectXPath) { XmlElement copyOfElement = element.XslElement("copy-of"); copyOfElement.AddAttributeWithValue("select", selectXPath); return(copyOfElement); }
public static XmlElement XslWhen(this XmlElement element, XPathExpr test) { XmlElement option = element.XslElement("when"); option.AddAttributeWithValue("test", test); return(option); }
private XPathExpr make_convert_operand(XPathExpr arg1, XPathExpr arg2) { throw new Exception(); //var args = new ArrayList(); //args.Add(arg1); //args.Add(arg2); //return make_function(new QName("fs", "convert-operand", OpFunctionLibrary.XPATH_OP_NS), args); }
public static XmlElement XslVariable(this XmlElement element, string name, XPathExpr selectXPath) { XmlElement variableElement = element.XslElement("variable"); variableElement.AddAttributeWithValue("name", name); if (selectXPath != null) { variableElement.AddAttributeWithValue("select", selectXPath); } return(variableElement); }
public override object visit(XPathExpr e) { if (e.slashes() > 0) { throw new XPathParserException("Access to root node is not allowed (set by caller)"); } do { e.expr().accept(this); // check the single step (may have filter with root access) e = e.next(); // follow singly linked list of the path, it's all relative past the first one } while (e != null); return(null); }
public static XmlElement XslTemplate(this XmlElement element, XPathExpr matchXPath, params string[] parameters) { XmlElement templateElement = element.XslElement("template"); templateElement.AddAttributeWithValue("match", matchXPath); if (parameters != null) { foreach (string parameter in parameters) { XmlElement param = templateElement.XslElement("param"); param.AddAttributeWithValue("name", parameter); } } return(templateElement); }
private static XmlElement XslApplyTemplates(this XmlElement element, XPathExpr selectXPath, IEnumerable <TemplateParameter> parameters) { XmlElement applyTemplatesElement = element.XslElement("apply-templates"); applyTemplatesElement.AddAttributeWithValue("select", selectXPath); if (parameters != null) { foreach (TemplateParameter keyValuePair in parameters) { XmlElement param = applyTemplatesElement.XslElement("with-param"); param.AddAttributeWithValue("name", keyValuePair.Name); param.AddAttributeWithValue("select", keyValuePair.Value); } } return(applyTemplatesElement); }
// fs:fname( fs:convert-operand( fn:data(ARG1), 1.0E0 ), // fs:convert-operand( fn:data(ARG2), 1.0E0 ) // ) private XPathExpr make_convert_binop(BinExpr e, XPathExpr convarg, QName name) { throw new Exception(); //ICollection args = normalize_bin_args(e); //XPathExpr[] args_arr = new XPathExpr[2]; //int j = 0; //for (IEnumerator i = args.GetEnumerator(); i.MoveNext();) //{ // args_arr[j] = (XPathExpr) i.Current; // j++; //} //var argsfname = new ArrayList(); //for (j = 0; j < 2; j++) //{ // XPathExpr arg = make_convert_operand(args_arr[j], convarg); // argsfname.Add(arg); //} //return make_function(name, argsfname); }
/// <summary> /// Validate an xpath expression. /// </summary> /// <param name="e"> /// is the expression. </param> /// <returns> null. </returns> public virtual object visit(XPathExpr e) { XPathExpr xp = e; bool firstStep = true; while (xp != null) { if (firstStep && xp.slashes() != 0) { _rootUsed = true; } firstStep = false; StepExpr se = xp.expr(); if (se != null) { se.accept(this); } xp = xp.next(); } return(null); }
public static XmlElement XslApplyTemplates(this XmlElement element, XPathExpr selectXPath, params TemplateParameter[] parameters) { return(XslApplyTemplates(element, selectXPath, (IEnumerable <TemplateParameter>)parameters)); }
public static XmlAttribute XslGroupStartingWithAttribute(this XmlDocument document, XPathExpr value, bool consequentInOneGroup) { if (!consequentInOneGroup) { XmlAttribute xslGroupStartingWithAttribute = document.CreateAttribute("group-starting-with"); xslGroupStartingWithAttribute.Value = value; return(xslGroupStartingWithAttribute); } else { XmlAttribute xslGroupStartingWithAttribute = document.CreateAttribute("group-starting-with"); xslGroupStartingWithAttribute.Value = string.Format("{0}[not(preceding-sibling::{0}[1] is preceding-sibling::*[1])]", value); return(xslGroupStartingWithAttribute); } }
/// <param name="e"> /// is the xpath expression. </param> /// <returns> result. </returns> public virtual object visit(XPathExpr e) { XPathExpr xp = e; int depth = 0; // indicates how many / we traversed XPathExpr result = e; while (xp != null) { int slashes = xp.slashes(); StepExpr se = xp.expr(); if (slashes == 1) { // this is a single slash and nothing else... if (se == null) { return(make_root_self_node()); } // /RelativePathExpr if (depth == 0) { XPathExpr xpe = make_root_self_node(); xpe.set_next(e); result = xpe; } } if (slashes == 2) { // //RelativePathExpr if (depth == 0) { XPathExpr desc = make_descendant_or_self(); desc.set_slashes(1); e.set_slashes(1); desc.set_next(e); XPathExpr root_self = make_root_self_node(); root_self.set_next(desc); return(root_self); } } if (se != null) { se.accept(this); } XPathExpr next = xp.next(); // peek if the next guy will have 2 slashes... if (next != null) { // StepExpr//StepExpr if (next.slashes() == 2) { // create the node to stick between the // slashes XPathExpr desc = make_descendant_or_self(); desc.set_slashes(1); // current node / desc / next xp.set_next(desc); desc.set_next(next); next.set_slashes(1); } } xp = next; depth++; } return(result); }
/// <param name="e"> /// is the xpath expression. </param> /// <returns> result. </returns> public virtual object visit(XPathExpr e) { e.expr().accept(this); e.next().accept(this); return(null); }
public TemplateParameter(string name, XPathExpr value) : this() { Name = name; Value = value; }