コード例 #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));
 }