public void Transform(Engine engine, Package package) { _log = TemplatingLogger.GetLogger(GetType()); RepositoryLocalObject context = engine.GetObject(package.GetByName(Package.PageName)) as RepositoryLocalObject; if (context == null) { _log.Error("Could not retrieve page from package. Exiting."); return; } string categoryUrl = context.ContextRepository.WebDavUrl + NavigationCategoryWebDavUrl; Category navigation = (Category)engine.GetObject(categoryUrl); using (MemoryStream ms = new MemoryStream()) { XmlTextWriter w = new XmlTextWriter(ms, new UTF8Encoding(false)) { Indentation = 4, Formatting = Formatting.Indented }; w.WriteStartDocument(); w.WriteStartElement(Navigation.RootNodeName); KeywordsFilter filter = new KeywordsFilter(engine.GetSession()) { IsRoot = true }; foreach (XmlNode rootChildren in navigation.GetListKeywords(filter)) { Keyword rootKeyword = (Keyword)engine.GetObject(rootChildren.Attributes["ID"].Value); w.WriteStartElement(Navigation.NodeName); NavigationNode n = new NavigationNode(rootKeyword); } } }