public TemplateWithPriority (XslTemplate t, double p) { Template = t; Pattern = t.Match; Priority = p; TemplateID = t.Id; }
public TemplateWithPriority (XslTemplate t, Pattern p) { Template = t; Pattern = p; Priority = p.DefaultPriority; TemplateID = t.Id; }
public XslKey (Compiler c) { this.name = c.ParseQNameAttribute ("name"); c.KeyCompilationMode = true; useExpr = c.CompileExpression (c.GetAttribute ("use")); if (useExpr == null) useExpr = c.CompileExpression ("."); c.AssertAttribute ("match"); string matchString = c.GetAttribute ("match"); this.matchPattern = c.CompilePattern (matchString, c.Input); c.KeyCompilationMode = false; }
internal void SetPreviousPattern (Pattern prev, bool isAncestor) { LocationPathPattern toSet = LastPathPattern; toSet.patternPrevious = (LocationPathPattern)prev; toSet.isAncestor = isAncestor; }
public bool Matches (Pattern p, XPathNavigator n) { return p.Matches (n, this.XPathContext); }
public UnionPattern(Pattern p0, Pattern p1) { this.p0 = p0; this.p1 = p1; }
public XslTemplate (Compiler c) { if (c == null) return; // built in template this.style = c.CurrentStylesheet; c.PushScope (); if (c.Input.Name == "template" && c.Input.NamespaceURI == Compiler.XsltNamespace && c.Input.MoveToAttribute ("mode", String.Empty)) { c.Input.MoveToParent (); if (!c.Input.MoveToAttribute ("match", String.Empty)) throw new XsltCompileException ("XSLT 'template' element must not have 'mode' attribute when it does not have 'match' attribute", null, c.Input); c.Input.MoveToParent (); } if (c.Input.NamespaceURI != Compiler.XsltNamespace) { this.name = QName.Empty; this.match = c.CompilePattern ("/", c.Input); this.mode = QName.Empty; } else { this.name = c.ParseQNameAttribute ("name"); this.match = c.CompilePattern (c.GetAttribute ("match"), c.Input); this.mode = c.ParseQNameAttribute ("mode"); string pri = c.GetAttribute ("priority"); if (pri != null) { try { this.priority = double.Parse (pri, CultureInfo.InvariantCulture); } catch (FormatException ex) { throw new XsltException ("Invalid priority number format", ex, c.Input); } } } Parse (c); stackSize = c.PopScope ().VariableHighTide; }
public void Add (XslTemplate t, Pattern p) { if (p is UnionPattern) { Add (t, ((UnionPattern)p).p0); Add (t, ((UnionPattern)p).p1); return; } unnamedTemplates.Add (new TemplateWithPriority (t, p)); }
public UnionPattern (Pattern p0, Pattern p1) { this.p0 = p0; this.p1 = p1; }
protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (this.DebugInput); c.CheckExtraAttributes ("number", "level", "count", "from", "value", "format", "lang", "letter-value", "grouping-separator", "grouping-size"); switch (c.GetAttribute ("level")) { case "single": level = XslNumberingLevel.Single; break; case "multiple": level = XslNumberingLevel.Multiple; break; case "any": level = XslNumberingLevel.Any; break; case null: case "": default: level = XslNumberingLevel.Single; // single == default break; } count = c.CompilePattern (c.GetAttribute ("count"), c.Input); from = c.CompilePattern (c.GetAttribute ("from"), c.Input); value = c.CompileExpression (c.GetAttribute ("value")); format = c.ParseAvtAttribute ("format"); lang = c.ParseAvtAttribute ("lang"); letterValue = c.ParseAvtAttribute ("letter-value"); groupingSeparator = c.ParseAvtAttribute ("grouping-separator"); groupingSize = c.ParseAvtAttribute ("grouping-size"); }