/// <summary> /// Transforms the specified document. /// </summary> /// <param name="doc">The document.</param> /// <param name="format">The format.</param> /// <returns>The transformed content.</returns> public string Transform(XmlDocument doc, GedcomReportFormat format) { string xslt = string.Format("Gedcom.Reports.Xslt.{0}-{1}.xslt", BaseXsltName, format.ToString()); Assembly asm = GetType().Assembly; Stream xsltStream = asm.GetManifestResourceStream(xslt); string tmpFile = null; if (xsltStream != null) { XmlTextReader reader = new XmlTextReader(xsltStream); XslCompiledTransform transform = new XslCompiledTransform(); transform.Load(reader); XPathNavigator nav = doc.CreateNavigator(); XsltArgumentList args = new XsltArgumentList(); args.AddParam("xrefId", string.Empty, XrefId); tmpFile = Path.GetTempFileName(); using (FileStream file = File.Open(tmpFile, FileMode.Append)) { transform.Transform(nav, args, file); } } return(tmpFile); }
public string Transform(XmlDocument doc, GedcomReportFormat format) { string xslt = string.Format("Gedcom.Reports.Xslt.{0}-{1}.xslt", _baseXsltName, format.ToString()); Assembly asm = GetType().Assembly; Stream xsltStream = asm.GetManifestResourceStream(xslt); string tmpFile = null; if (xsltStream != null) { XmlTextReader reader = new XmlTextReader(xsltStream); XslCompiledTransform transform = new XslCompiledTransform(); transform.Load(reader); XPathNavigator nav = doc.CreateNavigator(); XsltArgumentList args = new XsltArgumentList(); args.AddParam("xrefId", string.Empty, _xrefId); tmpFile = Path.GetTempFileName(); using (FileStream file = File.Open(tmpFile, FileMode.Append)) { transform.Transform(nav, args, file); } } return tmpFile; }