private void HandleTopLevelElement (Compiler c)
		{
			XPathNavigator n = c.Input;
			switch (n.NamespaceURI)
			{
			case XsltNamespace:
				switch (n.LocalName)
				{
				case "include":
					HandleInclude (c);
					break;
				case "preserve-space":
					AddSpaceControls (c.ParseQNameListAttribute ("elements"), XmlSpace.Preserve, n);
					break;
				
				case "strip-space":
					AddSpaceControls (c.ParseQNameListAttribute ("elements"), XmlSpace.Default, n);
					break;
				case "namespace-alias":
					// do nothing. It is handled in prior.
					break;
				
				case "attribute-set":
					c.AddAttributeSet (new XslAttributeSet (c));
					break;

				case "key":
					XslKey key = new XslKey (c);
					if (keys [key.Name] == null)
						keys [key.Name] = new ArrayList ();
					((ArrayList) keys [key.Name]).Add (key);
					break;
					
				case "output":
					c.CompileOutput ();
					break;
				
				case "decimal-format":
					c.CompileDecimalFormat ();
					break;
					
				case "template":
					templates.Add (new XslTemplate (c));	
					break;
				case "variable":
					XslGlobalVariable gvar = new XslGlobalVariable (c);
					variables [gvar.Name] = gvar;
					break;
				case "param":
					XslGlobalParam gpar = new XslGlobalParam (c);
					variables [gpar.Name] = gpar;
					break;
				default:
					if (version == "1.0")
						throw new XsltCompileException ("Unrecognized top level element after imports", null, c.Input);
					break;
				}
				break;
			case MSXsltNamespace:
				switch (n.LocalName)
				{
				case "script":
					c.ScriptManager.AddScript (c);
					break;
				}
				break;
			}
		}
Пример #2
0
		public void AddGlobalVariable (XslGlobalVariable var)
		{
			globalVariables [var.Name] = var;
		}