Ejemplo n.º 1
0
 public XslNodeEx(XslNodeType t, QilName name, object arg, XslVersion xslVer) : base(t, name, arg, xslVer)
 {
 }
Ejemplo n.º 2
0
        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)
        {
        }
Ejemplo n.º 3
0
 public XslNodeEx(XslNodeType t, QilName name, object arg, ContextInfo ctxInfo, XslVersion xslVer)
     : base(t, name, arg, xslVer)
 {
     ElemNameLi = ctxInfo.elemNameLi;
     EndTagLi   = ctxInfo.endTagLi;
 }
Ejemplo n.º 4
0
        /*  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;
            }
        }
Ejemplo n.º 5
0
        public CycleCheck CycleCheck;     // Used to detect circular references

        public AttributeSet(QilName name, XslVersion xslVer) : base(XslNodeType.AttributeSet, name, xslVer)
        {
        }
Ejemplo n.º 6
0
 public static XslNodeEx ApplyTemplates(QilName mode, string select, ContextInfo ctxInfo, XslVersion xslVer)
 {
     return(new XslNodeEx(XslNodeType.ApplyTemplates, mode, select, ctxInfo, xslVer));
 }
Ejemplo n.º 7
0
 public static AttributeSet AttributeSet(QilName name)
 {
     return(new AttributeSet(name, XslVersion.Current));
 }
Ejemplo n.º 8
0
 public static XslNode UseAttributeSet(QilName name)
 {
     return(new XslNode(XslNodeType.UseAttributeSet, name, null, XslVersion.Current));
 }
Ejemplo n.º 9
0
 public static VarPar VarPar(XslNodeType nt, QilName name, string?select, XslVersion xslVer)
 {
     return(new VarPar(nt, name, select, xslVer));
 }
Ejemplo n.º 10
0
 public static XslNode LiteralElement(QilName name)
 {
     return(new XslNode(XslNodeType.LiteralElement, name, null, XslVersion.Current));
 }
Ejemplo n.º 11
0
 public static Template Template(QilName?name, string?match, QilName mode, double priority, XslVersion xslVer)
 {
     return(new Template(name, match, mode, priority, xslVer));
 }
Ejemplo n.º 12
0
 public static XslNode LiteralAttribute(QilName name, string value, XslVersion xslVer)
 {
     return(new XslNode(XslNodeType.LiteralAttribute, name, value, xslVer));
 }
Ejemplo n.º 13
0
 public static Key Key(QilName name, string?match, string?use, XslVersion xslVer)
 {
     return(new Key(name, match, use, xslVer));
 }
Ejemplo n.º 14
0
        public bool IsPhantomName(QilName qname)
        {
            string nsUri = qname.NamespaceUri;

            return(nsUri.Length > 0 && nsUri[0] == '\0');
        }
Ejemplo n.º 15
0
 public static XslNode XslNode(XslNodeType nodeType, QilName name, string arg, XslVersion xslVer)
 {
     return(new XslNode(nodeType, name, arg, xslVer));
 }
Ejemplo n.º 16
0
 public static VarPar WithParam(QilName name)
 {
     return(VarPar(XslNodeType.WithParam, name, /*select*/ null, XslVersion.Current));
 }
Ejemplo n.º 17
0
 public static XslNode ApplyImports(QilName mode, Stylesheet sheet, XslVersion xslVer)
 {
     return(new XslNode(XslNodeType.ApplyImports, mode, sheet, xslVer));
 }
Ejemplo n.º 18
0
 // 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);
 }
Ejemplo n.º 19
0
 // Special node for start apply-templates
 public static XslNodeEx ApplyTemplates(QilName mode)
 {
     return(new XslNodeEx(XslNodeType.ApplyTemplates, mode, /*select:*/ null, XslVersion.Current));
 }
Ejemplo n.º 20
0
        public QilFunction Function;                   // Compiled body

        public ProtoTemplate(XslNodeType nt, QilName name, XslVersion xslVer) : base(nt, name, null, xslVer)
        {
        }
Ejemplo n.º 21
0
 public static XslNodeEx CallTemplate(QilName name, ContextInfo ctxInfo)
 {
     return(new XslNodeEx(XslNodeType.CallTemplate, name, null, ctxInfo, XslVersion.Current));
 }
Ejemplo n.º 22
0
        public CycleCheck CycleCheck;                   // Used to detect circular references

        public AttributeSet(QilName name, XslVersion xslVer) : base(XslNodeType.AttributeSet, name, xslVer)
        {
            Debug.Assert(name != null);
        }