Ejemplo n.º 1
0
        public static XslTransformResult Transform(string sourceXml, string transformXsl, DateTime?startOrNull = null)
        {
            var start = startOrNull ?? DateTime.Now;

            try
            {
                var result = TransformInternal(sourceXml, transformXsl);
                return(XslTransformResult.Success(DateTime.Now.Subtract(start), result));
            }
            catch (Exception exception)
            {
                return(XslTransformResult.Failure(DateTime.Now.Subtract(start), exception));
            }
        }
Ejemplo n.º 2
0
        public static XslTransformResult Transform(FileInfo source, FileInfo transform)
        {
            var start = DateTime.Now;

            try
            {
                var sourceXml    = File.ReadAllText(source.FullName);
                var transformXsl = File.ReadAllText(transform.FullName);
                return(Transform(sourceXml, transformXsl, startOrNull: start));
            }
            catch (Exception exception)
            {
                return(XslTransformResult.Failure(DateTime.Now.Subtract(start), exception));
            }
        }