public XslNodeEx(XslNodeType t, QilName name, object arg, XslVersion xslVer) : base(t, name, arg, xslVer) { }
public QilNode Value; // Contains value for WithParams and global VarPars public VarPar(XslNodeType nt, QilName name, string select, XslVersion xslVer) : base(nt, name, select, xslVer) { }
public XslNodeEx(XslNodeType t, QilName name, object arg, ContextInfo ctxInfo, XslVersion xslVer) : base(t, name, arg, xslVer) { ElemNameLi = ctxInfo.elemNameLi; EndTagLi = ctxInfo.endTagLi; }
/* NOTE: This code depends on the form of Qil expressions generated by XPathPatternBuilder. * More specifically, it recognizes the following two patterns: * * A) /, *, @*, text(), comment(), processing-instruction(): * (And* $x:(IsType RefTo LiteralType)) * * B) foo, @ns:foo, processing-instruction('foo'): * (And* $x:(And (IsType RefTo LiteralType) (Eq (NameOf RefTo) LiteralQName))) * * where all RefTo refer to 'it', and LiteralType has exactly one NodeKind bit set. * * If one of patterns recognized, we nip $x off of the nested And sequence: * (And* (And2 (And1 $x:* $y:*) $z:*)) => (And* (And2 $y:* $z:*)) */ private void NipOffTypeNameCheck() { QilBinary[] leftPath = new QilBinary[4]; // Circular buffer for last 4 And nodes int idx = -1; // Index of last element in leftPath QilNode node = condition; // Walker through left path of the tree nodeKind = XmlNodeKindFlags.None; qname = null; while (node.NodeType == QilNodeType.And) { node = (leftPath[++idx & 3] = (QilBinary)node).Left; } // Recognizing (IsType RefTo LiteralType) if (!(node.NodeType == QilNodeType.IsType)) { return; } QilBinary isType = (QilBinary)node; if (!(isType.Left == iterator && isType.Right.NodeType == QilNodeType.LiteralType)) { return; } XmlNodeKindFlags nodeKinds = isType.Right.XmlType.NodeKinds; if (!Bits.ExactlyOne((uint)nodeKinds)) { return; } // Recognized pattern A, check for B QilNode x = isType; nodeKind = nodeKinds; QilBinary lastAnd = leftPath[idx & 3]; if (lastAnd != null && lastAnd.Right.NodeType == QilNodeType.Eq) { QilBinary eq = (QilBinary)lastAnd.Right; // Recognizing (Eq (NameOf RefTo) LiteralQName) if (eq.Left.NodeType == QilNodeType.NameOf && ((QilUnary)eq.Left).Child == iterator && eq.Right.NodeType == QilNodeType.LiteralQName ) { // Recognized pattern B x = lastAnd; qname = (QilName)((QilLiteral)eq.Right).Value; idx--; } } // Nip $x off the condition QilBinary and1 = leftPath[idx & 3]; QilBinary and2 = leftPath[--idx & 3]; if (and2 != null) { and2.Left = and1.Right; } else if (and1 != null) { condition = and1.Right; } else { condition = null; } }
public CycleCheck CycleCheck; // Used to detect circular references public AttributeSet(QilName name, XslVersion xslVer) : base(XslNodeType.AttributeSet, name, xslVer) { }
public static XslNodeEx ApplyTemplates(QilName mode, string select, ContextInfo ctxInfo, XslVersion xslVer) { return(new XslNodeEx(XslNodeType.ApplyTemplates, mode, select, ctxInfo, xslVer)); }
public static AttributeSet AttributeSet(QilName name) { return(new AttributeSet(name, XslVersion.Current)); }
public static XslNode UseAttributeSet(QilName name) { return(new XslNode(XslNodeType.UseAttributeSet, name, null, XslVersion.Current)); }
public static VarPar VarPar(XslNodeType nt, QilName name, string?select, XslVersion xslVer) { return(new VarPar(nt, name, select, xslVer)); }
public static XslNode LiteralElement(QilName name) { return(new XslNode(XslNodeType.LiteralElement, name, null, XslVersion.Current)); }
public static Template Template(QilName?name, string?match, QilName mode, double priority, XslVersion xslVer) { return(new Template(name, match, mode, priority, xslVer)); }
public static XslNode LiteralAttribute(QilName name, string value, XslVersion xslVer) { return(new XslNode(XslNodeType.LiteralAttribute, name, value, xslVer)); }
public static Key Key(QilName name, string?match, string?use, XslVersion xslVer) { return(new Key(name, match, use, xslVer)); }
public bool IsPhantomName(QilName qname) { string nsUri = qname.NamespaceUri; return(nsUri.Length > 0 && nsUri[0] == '\0'); }
public static XslNode XslNode(XslNodeType nodeType, QilName name, string arg, XslVersion xslVer) { return(new XslNode(nodeType, name, arg, xslVer)); }
public static VarPar WithParam(QilName name) { return(VarPar(XslNodeType.WithParam, name, /*select*/ null, XslVersion.Current)); }
public static XslNode ApplyImports(QilName mode, Stylesheet sheet, XslVersion xslVer) { return(new XslNode(XslNodeType.ApplyImports, mode, sheet, xslVer)); }
// Add variable to the current scope. Returns false in case of duplicates. public void AddVariable(QilName varName, V value) { Debug.Assert(varName.LocalName != null && varName.NamespaceUri != null); AddRecord(ScopeFlags.Variable, varName.LocalName, varName.NamespaceUri, value); }
// Special node for start apply-templates public static XslNodeEx ApplyTemplates(QilName mode) { return(new XslNodeEx(XslNodeType.ApplyTemplates, mode, /*select:*/ null, XslVersion.Current)); }
public QilFunction Function; // Compiled body public ProtoTemplate(XslNodeType nt, QilName name, XslVersion xslVer) : base(nt, name, null, xslVer) { }
public static XslNodeEx CallTemplate(QilName name, ContextInfo ctxInfo) { return(new XslNodeEx(XslNodeType.CallTemplate, name, null, ctxInfo, XslVersion.Current)); }
public CycleCheck CycleCheck; // Used to detect circular references public AttributeSet(QilName name, XslVersion xslVer) : base(XslNodeType.AttributeSet, name, xslVer) { Debug.Assert(name != null); }