protected override void Compile (Compiler c) { if (c.Debugger != null) c.Debugger.DebugCompile (this.DebugInput); hasStack = (c.CurrentVariableScope == null); c.PushScope (); do { Debug.EnterNavigator (c); XPathNavigator n = c.Input; switch (n.NodeType) { case XPathNodeType.Element: switch (n.NamespaceURI) { case XsltNamespace: switch (n.LocalName) { case "apply-imports": content.Add (new XslApplyImports (c)); break; case "apply-templates": content.Add (new XslApplyTemplates (c)); break; case "attribute": if (ParentType == XPathNodeType.All || ParentType == XPathNodeType.Element) content.Add (new XslAttribute (c)); break; case "call-template": content.Add (new XslCallTemplate (c)); break; case "choose": content.Add (new XslChoose (c)); break; case "comment": if (ParentType == XPathNodeType.All || ParentType == XPathNodeType.Element) content.Add (new XslComment (c)); break; case "copy": content.Add (new XslCopy (c)); break; case "copy-of": content.Add (new XslCopyOf (c)); break; case "element": if (ParentType == XPathNodeType.All || ParentType == XPathNodeType.Element) content.Add (new XslElement (c)); break; case "fallback": break; case "for-each": content.Add (new XslForEach (c)); break; case "if": content.Add (new XslIf (c)); break; case "message": content.Add (new XslMessage(c)); break; case "number": content.Add (new XslNumber(c)); break; case "processing-instruction": if (ParentType == XPathNodeType.All || ParentType == XPathNodeType.Element) content.Add (new XslProcessingInstruction(c)); break; case "text": content.Add (new XslText(c, false)); break; case "value-of": content.Add (new XslValueOf(c)); break; case "variable": content.Add (new XslLocalVariable (c)); break; case "sort": if (xslForEach) break; throw new XsltCompileException ("'sort' element is not allowed here as a templete content", null, n); default: // TODO: handle fallback, like we should // throw new XsltCompileException ("Did not recognize element " + n.Name, null, n); content.Add (new XslNotSupportedOperation (c)); break; } break; default: if (!c.IsExtensionNamespace (n.NamespaceURI)) content.Add (new XslLiteralElement(c)); else { if (n.MoveToFirstChild ()) { do { if (n.NamespaceURI == XsltNamespace && n.LocalName == "fallback") content.Add (new XslFallback (c)); } while (n.MoveToNext ()); n.MoveToParent (); } } break; } break; case XPathNodeType.SignificantWhitespace: content.Add (new XslText(c, true)); break; case XPathNodeType.Text: content.Add (new XslText(c, false)); break; default: break; } Debug.ExitNavigator (c); } while (c.Input.MoveToNext ()); if (hasStack) { stackSize = c.PopScope ().VariableHighTide; hasStack = stackSize > 0; } else c.PopScope (); }