public XmlDocument Validation(string xmlfile)
        {
            XmlDocument    doc = null;
            DomDestination dom = new DomDestination();
            Stream         src = null;

            try
            {
                if (_schematron == null)
                {
                    throw new Exception("incompleted schema stylesheet");
                }

                FileInfo file    = new FileInfo(xmlfile);
                Uri      baseuri = new Uri(file.DirectoryName + "/");

                src = file.OpenRead();

                _schematron.SetInputStream(src, baseuri);
                _schematron.Run(dom);

                doc = dom.XmlDocument;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dom.Close();
                src?.Close();
                src?.Dispose();
            }
            return(doc);
        }
        private Stream Transform(XsltTransformer xslt, Stream src, Uri baseuri)
        {
            MemoryStream   dst = null;
            DomDestination dom = new DomDestination();

            try
            {
                xslt.SetInputStream(src, baseuri);
                xslt.Run(dom);

                dst = new MemoryStream();

                dom.XmlDocument.Save(dst);

                dst.Flush();
                dst.Position = 0;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dom.Close();
            }
            return(dst);
        }