示例#1
0
        public static XDocument TransformToXDoc(XmlReader reader, string xslFile, XsltArgumentList args,
                                                TransformSetting setting, XmlResolver resolver)
        {
            XslCompiledTransform transform = GetTransformFromFile(xslFile, setting);

            return(TransformToXDoc(reader, transform, args, resolver));
        }
示例#2
0
        public override object Create(string key, params object[] args)
        {
            TransformSetting setting     = args[0] as TransformSetting;
            FilesXmlResolver resolver    = new FilesXmlResolver();
            XsltSettings     xsltSetting = setting.NeedEvidence ? XsltSettings.TrustedXslt
                : XsltSettings.Default;
            XslCompiledTransform transform = new XslCompiledTransform();

            transform.Load(key, xsltSetting, resolver);
            return(new XsltTransformCacheData(transform, resolver.GetFileNames()));
        }
示例#3
0
        public static XDocument TransformToXDoc(XmlReader reader, Type xsltType,
                                                XsltArgumentList args, TransformSetting setting)
        {
            TkDebug.AssertArgumentNull(reader, "reader", null);
            TkDebug.AssertArgumentNull(xsltType, "xsltType", null);
            TkDebug.AssertArgumentNull(setting, "setting", null);

            XslCompiledTransform transform = GetTransformFromType(xsltType, setting);

            return(TransformToXDoc(reader, transform, args));
        }
示例#4
0
        private static XslCompiledTransform GetTransformFromType(Type type, TransformSetting setting)
        {
            TkDebug.ThrowIfNoAppSetting();

            XslCompiledTransform result = null;
            bool cache = setting.UseCache && BaseAppSetting.Current.UseCache;

            if (cache)
            {
                XsltTransformCacheData data = CacheManager.GetItem("XsltTransformType",
                                                                   type.ToString(), type, setting).Convert <XsltTransformCacheData>();
                result = data.Transform;
            }
            else
            {
                result = new XslCompiledTransform();
                result.Load(type);
            }
            return(result);
        }
示例#5
0
        private static XslCompiledTransform GetTransformFromFile(string xslFile, TransformSetting setting)
        {
            TkDebug.ThrowIfNoAppSetting();

            XslCompiledTransform result = null;
            bool cache = setting.UseCache && BaseAppSetting.Current.UseCache;

            if (cache)
            {
                XsltTransformCacheData data = CacheManager.GetItem("XsltTransformFile",
                                                                   xslFile, setting).Convert <XsltTransformCacheData>();
                result = data.Transform;
            }
            else
            {
                result = new XslCompiledTransform();
                XsltSettings xsltSetting = setting.NeedEvidence ? XsltSettings.TrustedXslt
                    : XsltSettings.Default;
                result.Load(new Uri(xslFile).ToString(), xsltSetting, fResolver);
            }

            return(result);
        }
示例#6
0
 public static XDocument TransformToXDoc(XmlReader reader, Type xsltType, TransformSetting setting)
 {
     return(TransformToXDoc(reader, xsltType, null, setting));
 }
示例#7
0
 public static XDocument TransformToXDoc(XmlReader reader, string xslFile, TransformSetting setting)
 {
     return(TransformToXDoc(reader, xslFile, null, setting));
 }
示例#8
0
        public static XDocument TransformToXDoc(string xmlStr, string xslFile, XsltArgumentList args, TransformSetting setting)
        {
            TkDebug.AssertArgumentNullOrEmpty(xmlStr, "xmlStr", null);
            TkDebug.AssertArgumentNullOrEmpty(xslFile, "xslFile", null);
            TkDebug.AssertArgumentNull(setting, "setting", null);

            XmlReader            xml       = GetXmlReader(xmlStr);
            XslCompiledTransform transform = GetTransformFromFile(xslFile, setting);

            return(TransformToXDoc(xml, transform, args));
        }
示例#9
0
 public static XDocument TransformToXDoc(string xmlStr, string xslFile, TransformSetting setting)
 {
     return(TransformToXDoc(xmlStr, xslFile, null, setting));
 }
示例#10
0
 public static string Transform(string xmlStr, Type xsltType, TransformSetting setting)
 {
     return(Transform(xmlStr, xsltType, null, setting));
 }
示例#11
0
 public static string Transform(XmlReader reader, Type xsltType, TransformSetting setting)
 {
     return(Transform(reader, xsltType, null, setting));
 }
示例#12
0
 public static string Transform(XmlReader reader, string xslFile, TransformSetting setting)
 {
     return(Transform(reader, xslFile, null, setting));
 }
示例#13
0
        public static string Transform(XmlReader reader, string xslFile, XsltArgumentList args, TransformSetting setting)
        {
            TkDebug.AssertArgumentNull(reader, "reader", null);
            TkDebug.AssertArgumentNullOrEmpty(xslFile, "xslFile", null);
            TkDebug.AssertArgumentNull(setting, "setting", null);

            XslCompiledTransform transform = GetTransformFromFile(xslFile, setting);

            return(Transform(reader, transform, args));
        }
示例#14
0
 public static string Transform(string xmlStr, string xslFile, TransformSetting setting)
 {
     return(Transform(xmlStr, xslFile, null, setting));
 }