private void CreateNAVDocument(XDocument contentDocument) { var html = new XElement(WWWNamespaces.XHTML + "html"); html.Add(new XAttribute(XNamespace.Xmlns + "epub", EPubNamespaces.OpsNamespace)); contentDocument.Add(html); var head = new XElement(WWWNamespaces.XHTML + "head"); html.Add(head); var meta = new XElement(WWWNamespaces.XHTML + "meta"); meta.Add(new XAttribute("charset","utf-8")); head.Add(meta); var title = new XElement(WWWNamespaces.XHTML + "title"); if (string.IsNullOrEmpty(PageTitle)) { title.Value = "Table of Contents"; } else { title.Value = WebUtility.HtmlEncode(PageTitle) + " - Table of Contents"; } head.Add(title); foreach (var file in _styles) { var cssStyleSheet = new Link(HTMLElementType.HTML5); cssStyleSheet.Relation.Value = "stylesheet"; cssStyleSheet.Type.Value = file.GetMediaType().GetAsSerializableString(); cssStyleSheet.HRef.Value = file.PathInEPUB.GetRelativePath(NAVFilePath, FlatStructure); head.Add(cssStyleSheet.Generate()); } var body = new XElement(WWWNamespaces.XHTML + "body"); body.Add(new XAttribute("class","nav_body")); html.Add(body); var navElement = _documentNavigationMap.GenerateXMLMap(); if (navElement != null) { body.Add(navElement); } var landmarksElement = _landmarks.GenerateXMLMap(); if (landmarksElement != null) { body.Add(landmarksElement); } }