示例#1
0
        private void HandleImport(Compiler c, string href)
        {
            c.PushInputDocument(href);
            XslStylesheet imported = new XslStylesheet();

            imported.Compile(c);
            imports.Add(imported);
            c.PopInputDocument();
        }
示例#2
0
        private void HandleImport(Compiler c, string href)
        {
            c.PushInputDocument(href);
            XslStylesheet xslStylesheet = new XslStylesheet();

            xslStylesheet.Compile(c);
            this.imports.Add(xslStylesheet);
            c.PopInputDocument();
        }
示例#3
0
        public CompiledStylesheet Compile(XPathNavigator nav, XmlResolver res, Evidence evidence)
        {
            this.xpathParser   = new XPathParser(this);
            this.patternParser = new XsltPatternParser(this);
            this.res           = res;
            if (res == null)
            {
                this.res = new XmlUrlResolver();
            }
            this.evidence = evidence;

            // reject empty document.
            if (nav.NodeType == XPathNodeType.Root && !nav.MoveToFirstChild())
            {
                throw new XsltCompileException("Stylesheet root element must be either \"stylesheet\" or \"transform\" or any literal element", null, nav);
            }
            while (nav.NodeType != XPathNodeType.Element)
            {
                nav.MoveToNext();
            }

            stylesheetVersion = nav.GetAttribute("version",
                                                 (nav.NamespaceURI != XsltNamespace) ?
                                                 XsltNamespace : String.Empty);
            outputs [""] = new XslOutput("", stylesheetVersion);

            PushInputDocument(nav);
            if (nav.MoveToFirstNamespace(XPathNamespaceScope.ExcludeXml))
            {
                do
                {
                    nsMgr.AddNamespace(nav.LocalName, nav.Value);
                }while (nav.MoveToNextNamespace(XPathNamespaceScope.ExcludeXml));
                nav.MoveToParent();
            }
            try
            {
                rootStyle = new XslStylesheet();
                rootStyle.Compile(this);
            }
            catch (XsltCompileException)
            {
                throw;
            }
            catch (Exception x)
            {
                throw new XsltCompileException("XSLT compile error. " + x.Message, x, Input);
            }

            return(new CompiledStylesheet(rootStyle, globalVariables, attrSets, nsMgr, keys, outputs, decimalFormats, msScripts));
        }
		private void HandleImport (Compiler c, string href)
		{
			c.PushInputDocument (href);
			XslStylesheet imported = new XslStylesheet ();
			imported.Compile (c);
			imports.Add (imported);
			c.PopInputDocument ();
		}
示例#5
0
文件: Compiler.cs 项目: GirlD/mono
		public CompiledStylesheet Compile (XPathNavigator nav, XmlResolver res, Evidence evidence)
		{
			this.xpathParser = new XPathParser (this);
			this.patternParser = new XsltPatternParser (this);
			this.res = res;
			if (res == null)
				this.res = new XmlUrlResolver ();
			this.evidence = evidence;

			// reject empty document.
			if (nav.NodeType == XPathNodeType.Root && !nav.MoveToFirstChild ())
				throw new XsltCompileException ("Stylesheet root element must be either \"stylesheet\" or \"transform\" or any literal element", null, nav);
			while (nav.NodeType != XPathNodeType.Element) nav.MoveToNext();
			
			stylesheetVersion = nav.GetAttribute ("version", 
				(nav.NamespaceURI != XsltNamespace) ?
				XsltNamespace : String.Empty);
			outputs [""] = new XslOutput ("", stylesheetVersion);
				
			PushInputDocument (nav);
			if (nav.MoveToFirstNamespace (XPathNamespaceScope.ExcludeXml))
			{
				do {
					nsMgr.AddNamespace (nav.LocalName, nav.Value);
				} while (nav.MoveToNextNamespace (XPathNamespaceScope.ExcludeXml));
				nav.MoveToParent ();
			}
			try {
				rootStyle = new XslStylesheet ();
				rootStyle.Compile (this);
			} catch (XsltCompileException) {
				throw;
			} catch (Exception x) {
				throw new XsltCompileException ("XSLT compile error. " + x.Message, x,  Input);
			}
			
			return new CompiledStylesheet (rootStyle, globalVariables, attrSets, nsMgr, keys, outputs, decimalFormats, msScripts);
		}