Ejemplo n.º 1
0
        private void HandleImport(Compiler c, string href)
        {
            c.PushInputDocument(href);
            XslStylesheet imported = new XslStylesheet();

            imported.Compile(c);
            imports.Add(imported);
            c.PopInputDocument();
        }
Ejemplo n.º 2
0
        private void HandleInclude(Compiler c)
        {
            XPathNavigator included = null;

            foreach (XPathNavigator inc in inProcessIncludes.Keys)
            {
                if (inc.IsSamePosition(c.Input))
                {
                    included = (XPathNavigator)inProcessIncludes [inc];
                    break;
                }
            }
            if (included == null)
            {
                throw new Exception("Should not happen. Current input is " + c.Input.BaseURI + " / " + c.Input.Name + ", " + inProcessIncludes.Count);
            }

            if (included.NodeType == XPathNodeType.Root)
            {
                return;                 // Already done.
            }
            c.PushInputDocument(included);
            included.MoveToRoot();
            included.MoveToFirstChild();

            while (c.Input.NodeType != XPathNodeType.Element)
            {
                if (!c.Input.MoveToNext())
                {
                    break;
                }
            }

            if (c.Input.NamespaceURI != XsltNamespace &&
                c.Input.NodeType == XPathNodeType.Element)
            {
                // then it is simplified stylesheet.
                templates.Add(new XslTemplate(c));
            }
            else
            {
                c.Input.MoveToFirstChild();
                do
                {
                    if (c.Input.NodeType != XPathNodeType.Element || c.Input.LocalName == "import" && c.Input.NamespaceURI == XsltNamespace)
                    {
                        continue;
                    }
                    Debug.EnterNavigator(c);
                    HandleTopLevelElement(c);
                    Debug.ExitNavigator(c);
                } while (c.Input.MoveToNext());
            }

            c.Input.MoveToParent();
            c.PopInputDocument();
        }
Ejemplo n.º 3
0
        private void HandleImport(Compiler c, string href)
        {
            c.PushInputDocument(href);
            XslStylesheet xslStylesheet = new XslStylesheet();

            xslStylesheet.Compile(c);
            this.imports.Add(xslStylesheet);
            c.PopInputDocument();
        }
Ejemplo n.º 4
0
        private void StoreInclude(Compiler c)
        {
            XPathNavigator key = c.Input.Clone();

            c.PushInputDocument(c.Input.GetAttribute("href", string.Empty));
            this.inProcessIncludes[key] = c.Input;
            this.HandleImportsInInclude(c);
            c.PopInputDocument();
        }
Ejemplo n.º 5
0
        private void StoreInclude(Compiler c)
        {
            XPathNavigator including = c.Input.Clone();

            c.PushInputDocument(c.Input.GetAttribute("href", String.Empty));
            inProcessIncludes [including] = c.Input;

            HandleImportsInInclude(c);
            c.PopInputDocument();
        }
Ejemplo n.º 6
0
        private void HandleInclude(Compiler c)
        {
            XPathNavigator xpathNavigator = null;

            foreach (object obj in this.inProcessIncludes.Keys)
            {
                XPathNavigator xpathNavigator2 = (XPathNavigator)obj;
                if (xpathNavigator2.IsSamePosition(c.Input))
                {
                    xpathNavigator = (XPathNavigator)this.inProcessIncludes[xpathNavigator2];
                    break;
                }
            }
            if (xpathNavigator == null)
            {
                throw new Exception(string.Concat(new object[]
                {
                    "Should not happen. Current input is ",
                    c.Input.BaseURI,
                    " / ",
                    c.Input.Name,
                    ", ",
                    this.inProcessIncludes.Count
                }));
            }
            if (xpathNavigator.NodeType == XPathNodeType.Root)
            {
                return;
            }
            c.PushInputDocument(xpathNavigator);
            while (c.Input.NodeType != XPathNodeType.Element)
            {
                if (!c.Input.MoveToNext())
                {
                    break;
                }
            }
            if (c.Input.NamespaceURI != "http://www.w3.org/1999/XSL/Transform" && c.Input.NodeType == XPathNodeType.Element)
            {
                this.templates.Add(new XslTemplate(c));
            }
            else
            {
                do
                {
                    if (c.Input.NodeType == XPathNodeType.Element)
                    {
                        this.HandleTopLevelElement(c);
                    }
                }while (c.Input.MoveToNext());
            }
            c.Input.MoveToParent();
            c.PopInputDocument();
        }