• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Xsl.XsltArgumentList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Xml.Xsl.XsltArgumentList的典型用法代码示例。如果您正苦于以下问题:C# XsltArgumentList类的具体用法?C# XsltArgumentList怎么用?C# XsltArgumentList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XsltArgumentList类属于System.Xml.Xsl命名空间,在下文中一共展示了XsltArgumentList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CopyAdditionalParams

 public static void CopyAdditionalParams(Dictionary<string, string> additionalParams, XsltArgumentList arguments)
 {
     foreach (KeyValuePair<string, string> pair in additionalParams)
     {
         arguments.AddParam(pair.Key, "", pair.Value);
     }
 }
开发者ID:anton210,项目名称:test,代码行数:7,代码来源:XslTransformer.cs


示例2: XTransformToWriter

        public static void XTransformToWriter(this Linq.XElement xmlDoc, TextWriter writer,
                    Linq.XElement xmlXslt = null, // Action<XslCompiledTransform> onXsltLoad = null, 
                    object xsltExtension = null,
                    string urn = "urn:request-info")
        {
            XslCompiledTransform trans = new XslCompiledTransform();
            //if (onXsltLoad != null)
            //    onXsltLoad(trans);
            //else
                trans.Load(xmlXslt.CreateReader());

            if (xsltExtension != null)
            {
                XsltArgumentList xslArg = new XsltArgumentList();
                xslArg.AddExtensionObject(urn, xsltExtension);

                // XTransformTo(trans, xmlDoc.CreateReader(), xslArg, writer);
                // var results = writer;
                XmlReader input = xmlDoc.CreateReader();
                XmlWriterSettings outputSettings = trans.OutputSettings;
                using (XmlWriter writerXml = XmlWriter.Create(writer, outputSettings))
                {
                    trans.Transform(input, arguments: xslArg, results: writerXml,
                          documentResolver: XmlNullResolver.Singleton); // XsltConfigSection.CreateDefaultResolver());
                    writerXml.Close();
                }
            }
            else
            {
                // trans.Transform(xmlDoc.CreateNavigator() as IXPathNavigable, arguments: null, results: writer);
                XTransformTo(trans, xmlDoc.CreateReader(), null, writer);
            }
        }
开发者ID:akrisiun,项目名称:git-dot-aspx,代码行数:33,代码来源:XPathWeb.cs


示例3: RenderRelatedNews

        private void RenderRelatedNews()
        {
            if (Request.QueryString[ConstantsManager.NewsGUID] == null)
                return;
            //int _newsID = 0; Int32.TryParse(Request.QueryString[ConstantsManager.NewsID], out _newsID);
            //if (_newsID == 0)
            //    return;
            string guid = Request.QueryString[ConstantsManager.NewsGUID].ToString();

            NewsItem _news = NewsItemManager.GetByGUID(guid);
            if (null == _news)
                return;


            XmlDocument xDoc = NewsItemManager.GetNewsByKeywordAsXML(_news.Keywords, _news.ID);

            if (null == xDoc)
                return;


            XslTemplate xslTemplate = XslTemplateManager.GetByID(XSLID);
            if (null == xslTemplate)
                return;
            XsltArgumentList arguments = new XsltArgumentList();
            arguments.AddExtensionObject("obj:CategoryViewer", this);
            _news.Keywords = "";
            _news.ViewCount++;
            NewsItemManager.Update(_news);
            string _html = UtilitiesManager.TransformXMLWithXSLText(xDoc.OuterXml, xslTemplate.Details, arguments);
            dvData.InnerHtml = _html;

        }
开发者ID:yalhami,项目名称:eXpresso,代码行数:32,代码来源:RelatedNews_UC.ascx.cs


示例4: LoadMenuItem

        void LoadMenuItem()
        {
            int menuID = 0;
            int.TryParse(Request.QueryString[CMSConfig.QueryString.MenuID], out menuID);

            if (base.XSLTemplateID > 0 && menuID > 0)
            {
                string xslPath = CMSWebHelper.GetXSLTemplateFilePath(base.XSLTemplateID);
                xslPath = XSLTemplateManager.GetXSLTemplatePath(xslPath, base.XSLTemplateID);

                XsltArgumentList arguments = new XsltArgumentList();
                arguments.AddExtensionObject("CMS:UserControl", this);

                Menu menu = new Menu();
                xmlMenu.DocumentContent = MenuManager.GetMenuItemTemplateXml(menuID, CMSContext.LanguageID, out menu);
                xmlMenu.TransformSource = xslPath;
                xmlMenu.TransformArgumentList = arguments;
                xmlMenu.DataBind();

                bool SetPageTitle = false;
                bool.TryParse(this.Attributes["SetPageTitle"], out SetPageTitle);

                if (SetPageTitle && menu != null)
                {
                    this.Page.Title = menu.Name;
                }
            }
        }
开发者ID:ajhCMS,项目名称:AJH.CMS.WEB.UI,代码行数:28,代码来源:MenuItemTemplateXSL_UC.ascx.cs


示例5: TransformHtml

        public static void TransformHtml(XmlSerializer serializer, object report, Type reportType, string outputFilePath, GeneratorConfiguration generatorConfiguration, string xsltFile)
        {
            var xmlOutputWriter = new StringWriter();
            serializer.Serialize(xmlOutputWriter, report);

            XslCompiledTransform xslt = new XslCompiledTransform();
            var xsltSettings = new XsltSettings(true, false);
            XmlResolver resourceResolver;

            var reportName = reportType.Name.Replace("Generator", "");
            using (var xsltReader = GetTemplateReader(reportType, reportName, xsltFile))
            {
                resourceResolver = new XmlResourceResolver();
                xslt.Load(xsltReader, xsltSettings, resourceResolver);
            }

            var xmlOutputReader = new XmlTextReader(new StringReader(xmlOutputWriter.ToString()));

            XsltArgumentList argumentList = new XsltArgumentList();
            argumentList.AddParam("feature-language", "", generatorConfiguration.FeatureLanguage.Name);
            argumentList.AddParam("tool-language", "", generatorConfiguration.ToolLanguage.Name);
            
            using (var xmlTextWriter = new XmlTextWriter(outputFilePath, Encoding.UTF8))
            {
				xslt.Transform(xmlOutputReader, argumentList, xmlTextWriter, resourceResolver);
            }            
        }
开发者ID:BEllis,项目名称:SpecFlow,代码行数:27,代码来源:XsltHelper.cs


示例6: Init

        public new void Init(object objParam)
        {
            // Get parameter info
            _strPath = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltApi\");

            xsltArg1 = new XsltArgumentList();

            MyObject obj1 = new MyObject(1, _output);
            MyObject obj2 = new MyObject(2, _output);
            MyObject obj3 = new MyObject(3, _output);
            MyObject obj4 = new MyObject(4, _output);
            MyObject obj5 = new MyObject(5, _output);

            xsltArg1.AddExtensionObject("urn:my-obj1", obj1);
            xsltArg1.AddExtensionObject("urn:my-obj2", obj2);
            xsltArg1.AddExtensionObject("urn:my-obj3", obj3);
            xsltArg1.AddExtensionObject("urn:my-obj4", obj4);
            xsltArg1.AddExtensionObject("urn:my-obj5", obj5);

            xsltArg1.AddParam("myArg1", szEmpty, "Test1");
            xsltArg1.AddParam("myArg2", szEmpty, "Test2");
            xsltArg1.AddParam("myArg3", szEmpty, "Test3");
            xsltArg1.AddParam("myArg4", szEmpty, "Test4");
            xsltArg1.AddParam("myArg5", szEmpty, "Test5");

            return;
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:27,代码来源:CXsltArgumentListMultith.cs


示例7: Transform

        public void Transform()
        {
            var xsltTemplateReader = new XmlTextReader(_xsltPath);
            var emptyDocumentReader = XmlReader.Create(new System.IO.StringReader("<empty />"));

            var settings = new XmlWriterSettings();
            //settings.ConformanceLevel = ConformanceLevel.Fragment;
            settings.Indent = true;

            using (var outputWriter = XmlWriter.Create(_outputPath, settings))
            {
                var xsltSettings = new XsltSettings();

                XsltArgumentList argumentList = new XsltArgumentList();

                var extensions = new XsltExtensionMethods(_settings);

                argumentList.AddExtensionObject("http://core.com/config", extensions);
                argumentList.AddExtensionObject("http://paralect.com/config", extensions);

                var transformer = new XslCompiledTransform(true);
                transformer.Load(xsltTemplateReader, xsltSettings, null);
                transformer.Transform(emptyDocumentReader,argumentList, outputWriter);
            }
        }
开发者ID:paralect,项目名称:Paralect.Config,代码行数:25,代码来源:XsltTransformer.cs


示例8: Register

        /// <exclude />
        public static void Register(XsltArgumentList argumentList)
        {
            foreach(string providerName in XslExtensionsProviderRegistry.XslExtensionsProviderNames)
            {
                List<Pair<string, object>> extensions;
                try
                {
                    extensions = XslExtensionsProviderPluginFacade.CreateExtensions(providerName);
                }
                catch(Exception ex)
                {
                    string message = "Failed to get xsl extensions from provider '{0}'".FormatWith(providerName);
                    LoggingService.LogError("XslExtensionsManager", new InvalidOperationException(message, ex));
                    continue;
                }

                if(extensions != null)
                {
                    foreach (Pair<string, object> pair in extensions)
                    {
                        argumentList.AddExtensionObject(pair.First, pair.Second);
                    }
                }
            }
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:26,代码来源:XslExtensionsManager.cs


示例9: Transform

        public void Transform(string inputFilePath, string outputFilePath, KeyValueConfigurationCollection settings)
        {
            var xsltTemplateReader = new XmlTextReader(inputFilePath);
            var emptyDocumentReader = XmlReader.Create(new System.IO.StringReader("<empty />"));

            var writerSettings = new XmlWriterSettings();
            //settings.ConformanceLevel = ConformanceLevel.Fragment;
            writerSettings.Indent = true;

            using (var outputWriter = XmlWriter.Create(outputFilePath, writerSettings))
            {
                var xsltSettings = new XsltSettings();

                XsltArgumentList argumentList = new XsltArgumentList();

                var extensions = new XsltExtensionMethods(settings);

                argumentList.AddExtensionObject("http://core.com/config", extensions);
                argumentList.AddExtensionObject("http://setty.net/config", extensions);

                var transformer = new XslCompiledTransform(true);
                transformer.Load(xsltTemplateReader, xsltSettings, null);
                transformer.Transform(emptyDocumentReader, argumentList, outputWriter);
            }
        }
开发者ID:paralect,项目名称:setty,代码行数:25,代码来源:XsltTransformer.cs


示例10: WriteProcessed

		/// <summary>
		/// Writes the results of XSLT transformation into the specified TextWriter.
		/// </summary>
		public static void WriteProcessed(string templateName, XsltArgumentList argumentList, XDocument data, TextWriter outStream)
		{
			using (XmlReader reader = data.CreateReader())
			{
				GetCompiledTransform(templateName).Transform(reader, argumentList, outStream);
			}
		}
开发者ID:shuruev,项目名称:CCNet.Extensions,代码行数:10,代码来源:TemplateEngine.cs


示例11: Transform

        /// <summary>
        /// Performs a XSL Transformation 
        /// </summary>
        /// <param name="styleSheet">Style Sheet path relative to Application Base directory</param>
        /// <param name="xslArguments">XSL Arguments</param>
        /// <param name="inputStream">Input Stream</param>
        /// <param name="outputStream">Out put Stream as Ref (output Stream is initialized if it is null</param>
        public void Transform(String styleSheet, Dictionary<String, String> xslArguments, Stream inputStream, ref Stream outputStream)
        {
            try
            {

                XsltSettings xsltSettings = new XsltSettings();
                xsltSettings.EnableScript = true;
                xsltSettings.EnableDocumentFunction = true;
                XsltArgumentList xslArgumentList = new XsltArgumentList();
                foreach (String key in xslArguments.Keys)
                {
                    xslArgumentList.AddParam(key, "", xslArguments[key]);
                }
                XslCompiledTransform transformer = new XslCompiledTransform();
                String stylesheetpath = AppDomain.CurrentDomain.BaseDirectory + styleSheet;
                transformer.Load(stylesheetpath, xsltSettings, new XmlUrlResolver());
                if (null == outputStream)
                {
                    outputStream = new MemoryStream();
                }
                StreamWriter streamWriter = new StreamWriter(outputStream);
                XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
                xmlReaderSettings.DtdProcessing = DtdProcessing.Ignore;
                XmlReader xmlReader = XmlReader.Create(inputStream, xmlReaderSettings);
                XmlTextWriter writer = new XmlTextWriter(outputStream,System.Text.Encoding.UTF8);
                writer.Formatting = Formatting.None;
                transformer.Transform(xmlReader, xslArgumentList, writer);

            }
            catch (Exception exception)
            {

                throw exception;
            }
        }
开发者ID:xchgdzq233,项目名称:testing,代码行数:42,代码来源:XSLUtility.cs


示例12: WriteToStreamAsync

        public override Task WriteToStreamAsync(Type type, object value, Stream writeStream, System.Net.Http.HttpContent content, System.Net.TransportContext transportContext)
        {
            var taskSource = new TaskCompletionSource<object>();
            try
            {
                var xml = (XmlNode) value;

              var documentElement = ((XmlDocument)value).DocumentElement;
              if (documentElement != null && documentElement.LocalName == "RDF") {
              ((XmlDocument)xml).Save(writeStream);
            }
            else {
              var parameters = new XsltArgumentList();
              var transform = XsltRepository.Get("RdfToHtml.xslt");
              transform.Transform(xml, parameters, writeStream);
            }

                taskSource.SetResult(null);
            }
            catch (Exception e)
            {
                taskSource.SetException(e);
            }
            return taskSource.Task;
        }
开发者ID:kennisnet,项目名称:Sparql-Query-Api,代码行数:25,代码来源:RdfHtmlMediaTypeFormatter.cs


示例13: CreateInstance

 /// <summary>
 /// Creates an instance of the given type from the specified Internet resource.
 /// </summary>
 /// <param name="htmlUrl">The requested URL, such as "http://Myserver/Mypath/Myfile.asp".</param>
 /// <param name="xsltUrl">The URL that specifies the XSLT stylesheet to load.</param>
 /// <param name="xsltArgs">An <see cref="XsltArgumentList"/> containing the namespace-qualified arguments used as input to the transform.</param>
 /// <param name="type">The requested type.</param>
 /// <param name="xmlPath">A file path where the temporary XML before transformation will be saved. Mostly used for debugging purposes.</param>
 /// <returns>An newly created instance.</returns>
 public object CreateInstance(string htmlUrl, string xsltUrl, XsltArgumentList xsltArgs, Type type,
                              string xmlPath)
 {
     StringWriter sw = new StringWriter();
     XmlTextWriter writer = new XmlTextWriter(sw);
     if (xsltUrl == null)
     {
         LoadHtmlAsXml(htmlUrl, writer);
     }
     else
     {
         if (xmlPath == null)
         {
             LoadHtmlAsXml(htmlUrl, xsltUrl, xsltArgs, writer);
         }
         else
         {
             LoadHtmlAsXml(htmlUrl, xsltUrl, xsltArgs, writer, xmlPath);
         }
     }
     writer.Flush();
     StringReader sr = new StringReader(sw.ToString());
     XmlTextReader reader = new XmlTextReader(sr);
     XmlSerializer serializer = new XmlSerializer(type);
     object o;
     try
     {
         o = serializer.Deserialize(reader);
     }
     catch (InvalidOperationException ex)
     {
         throw new Exception(ex + ", --- xml:" + sw);
     }
     return o;
 }
开发者ID:ToFuKing,项目名称:HtmlAgilityPack,代码行数:44,代码来源:HtmlWeb.Xpath.cs


示例14: Render

		public void Render(object source, HtmlTextWriter htmlWriter, TemplateDefinition liveDefinition)
		{
			var resolver = new PathResolver(liveDefinition.Folder);
			var hostPage = DNNContext.Current.Page;

			var args = new XsltArgumentList();
			args.AddExtensionObject("urn:ddrmenu", new XsltFunctions());
			args.AddExtensionObject("urn:dnngarden", new XsltFunctions());
			args.AddParam("ControlID", "", DNNContext.Current.HostControl.ClientID);
			args.AddParam("Options", "", ConvertToJson(liveDefinition.ClientOptions));
			args.AddParam("DNNPath", "", hostPage.ResolveUrl(resolver.Resolve("/", PathResolver.RelativeTo.Dnn)));
			args.AddParam("ManifestPath", "", hostPage.ResolveUrl(resolver.Resolve("/", PathResolver.RelativeTo.Manifest)));
			args.AddParam("PortalPath", "", hostPage.ResolveUrl(resolver.Resolve("/", PathResolver.RelativeTo.Portal)));
			args.AddParam("SkinPath", "", hostPage.ResolveUrl(resolver.Resolve("/", PathResolver.RelativeTo.Skin)));
			liveDefinition.TemplateArguments.ForEach(a => args.AddParam(a.Name, "", a.Value));

			HttpContext.Current.Items["Resolver"] = resolver;

			using (var xmlStream = new MemoryStream())
			{
				Utilities.SerialiserFor(source.GetType()).Serialize(xmlStream, source);
				xmlStream.Seek(0, SeekOrigin.Begin);
				xsl.Transform(XmlReader.Create(xmlStream), args, htmlWriter);
			}
		}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:25,代码来源:XsltTemplateProcessor.cs


示例15: BuildNavigator

        public void BuildNavigator(string modelFilePath)
        {
            XmlResolver resolver = new XmlUrlResolver();
            resolver.Credentials = CredentialCache.DefaultCredentials;
            XmlTextReader tr = new XmlTextReader(modelFilePath);
            XslCompiledTransform transform = new XslCompiledTransform();
            transform.Load(this.stylesheetFilesPath + Path.DirectorySeparatorChar + "ModelTree.xsl",null,resolver);
            XmlTextWriter tw = new XmlTextWriter(this.htmlFilesPath + Path.DirectorySeparatorChar + "ModelTree.htm", Encoding.UTF8);
            XsltArgumentList al = new XsltArgumentList();
            al.AddParam("modelBrowser","",this.localizer.GetValue("Globals","ModelBrowser"));
            al.AddParam("glossary","",this.localizer.GetValue("Globals","Glossary"));
            al.AddParam("stakeholders", "", this.localizer.GetValue("Globals", "Stakeholders"));
            transform.Transform(tr,al,tw,null);
            tw.Close();
            tr.Close();

            tr = new XmlTextReader(modelFilePath);
            transform.Load(this.stylesheetFilesPath + Path.DirectorySeparatorChar + "HomePage.xsl",null,resolver);
            tw = new XmlTextWriter(this.htmlFilesPath + Path.DirectorySeparatorChar + "main.htm",Encoding.UTF8);
            al = new XsltArgumentList();
            AssemblyName an = this.GetType().Assembly.GetName();
            al.AddParam("version","",an.Version.ToString(3));
            al.AddParam("model", "", this.localizer.GetValue("Globals", "Model"));
            al.AddParam("author", "", this.localizer.GetValue("Globals", "Author"));
            al.AddParam("company", "", this.localizer.GetValue("Globals", "Company"));
            al.AddParam("creationDate", "", this.localizer.GetValue("Globals", "CreationDate"));
            al.AddParam("exportPrintDate", "", this.localizer.GetValue("Globals", "ExportPrintDate"));
            al.AddParam("now", "", Convert.ToString(DateTime.Now, DateTimeFormatInfo.InvariantInfo));
            al.AddParam("release", "", this.localizer.GetValue("Globals", "Release"));
            transform.Transform(tr,al,tw,null);
            tw.Close();
            tr.Close();
        }
开发者ID:stephen-czetty,项目名称:UseCaseMaker,代码行数:33,代码来源:HTMLConverter.cs


示例16: CreateNuspecGraph

        public static IGraph CreateNuspecGraph(XDocument nuspec, string baseAddress)
        {
            nuspec = NormalizeNuspecNamespace(nuspec);

            XslCompiledTransform transform = CreateTransform("xslt.nuspec.xslt");

            XsltArgumentList arguments = new XsltArgumentList();
            arguments.AddParam("base", "", baseAddress + "packages/");
            arguments.AddParam("extension", "", ".json");

            arguments.AddExtensionObject("urn:helper", new XsltHelper());

            XDocument rdfxml = new XDocument();
            using (XmlWriter writer = rdfxml.CreateWriter())
            {
                transform.Transform(nuspec.CreateReader(), arguments, writer);
            }

            RdfXmlParser rdfXmlParser = new RdfXmlParser();
            XmlDocument doc = new XmlDocument();
            doc.Load(rdfxml.CreateReader());
            IGraph graph = new Graph();
            rdfXmlParser.Load(graph, doc);

            return graph;
        }
开发者ID:rvesse,项目名称:NuGet.Services.Metadata,代码行数:26,代码来源:Utils.cs


示例17: LoadCategory

        void LoadCategory()
        {
            if (base.XSLTemplateID > 0)
            {
                int ParentCategoryID = 0;
                if (base.ContainerValue > 0)
                {
                    ParentCategoryID = base.ContainerValue;
                }
                else
                {
                    int.TryParse(Request.QueryString[CMSConfig.QueryString.CategoryID], out ParentCategoryID);
                }
                string categoryXML = CategoryManager.GetCategoryPublishXML(base.ModuleID, ParentCategoryID);

                string xslPath = CMSWebHelper.GetXSLTemplateFilePath(base.XSLTemplateID);
                xslPath = XSLTemplateManager.GetXSLTemplatePath(xslPath, base.XSLTemplateID);

                XsltArgumentList arguments = new XsltArgumentList();
                arguments.AddExtensionObject("CMS:UserControl", this);

                xmlCategory.DocumentContent = categoryXML;
                xmlCategory.TransformSource = xslPath;
                xmlCategory.TransformArgumentList = arguments;
                xmlCategory.DataBind();
            }
        }
开发者ID:ajhCMS,项目名称:AJH.CMS.WEB.UI,代码行数:27,代码来源:CategoryXSL_UC.ascx.cs


示例18: Program

        public Program()
        {
            //Set the UI to the specified culture.
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(_culturename);

            //Create the XslTransform and load the stylesheet.
            //XslTransform xslt = new XslTransform();
            XslCompiledTransform xslt = new XslCompiledTransform();
            xslt.Load(_stylesheet);

            //Load the XML data file.
            XPathDocument doc = new XPathDocument(_filename);

            //Create an XsltArgumentList.
            XsltArgumentList xslArg = new XsltArgumentList();

            //Add an object to get the resources for the specified language.
            ResourceTranslator resTran = new ResourceTranslator("Resources.Resource");
            xslArg.AddExtensionObject("urn:myResTran", resTran);

            //Add an object to calculate the circumference of the circle.
            Calculate obj = new Calculate();
            xslArg.AddExtensionObject("urn:myObj", obj);

            //Create an XmlTextWriter to output to the console.
            XmlTextWriter writer = new XmlTextWriter(Console.Out);

            //Transform the file.
            xslt.Transform(doc, xslArg, writer, null);

            writer.Close();
        }
开发者ID:BryanAvery,项目名称:XslResourceTranslator,代码行数:32,代码来源:Program.cs


示例19: Transform

        public static string Transform(string xml,string xslFile)
        {
            XslTransform transform = new XslTransform();
            XsltArgumentList args = new XsltArgumentList();
            //define the xslt rendering file
            //get the iterators for the root and context item
            XPathDocument xmlDoc = new XPathDocument(new StringReader(xml));
            XPathNavigator iter = xmlDoc.CreateNavigator();

            //define and add the xslt extension classes
            //Sitecore.Xml.Xsl.XslHelper sc = new Sitecore.Xml.Xsl.XslHelper();
            XsltHelper xslt = new XsltHelper();
            args.AddExtensionObject("http://www.rlmcore.vn/helper", xslt);

            //add parameters
            args.AddParam("item", "", iter);
            args.AddParam("currentitem", "", iter.Select("."));
            //define the stream which will contain the result of xslt transformation
            //StringBuilder sb = new StringBuilder();
            //TextWriter stream = new FileStream(new MemoryStream(Encoding.ASCII.GetBytes(sb.ToString())));
            System.IO.StringWriter stream = new System.IO.StringWriter();

            //load xslt rendering to XslTransform class
            transform.Load(xslFile);
            //perform a transformation with the rendering
            transform.Transform(iter, args, stream);

            return stream.ToString();
        }
开发者ID:vinasourcetutran,项目名称:searchengine,代码行数:29,代码来源:XsltHelper.cs


示例20: RenderComponentFieldAsBBCode

        public string RenderComponentFieldAsBBCode(string fieldExpression, int fieldIndex, bool outputImages)
        {
            BuiltInFunctions functions = new BuiltInFunctions(_engine, _package);
            string output = functions.RenderComponentField(fieldExpression, fieldIndex);

            StringReader sr = new StringReader(output);
            NameTable nt = new NameTable();
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
            nsmgr.AddNamespace("tcdl", Tridion.ContentManager.Templating.TcdlTags.TcdlNamespace);
            XmlParserContext parserContext = new XmlParserContext(null, nsmgr, null, XmlSpace.None);

            XmlReader xmlReader = XmlReader.Create(sr, new XmlReaderSettings(), parserContext);

            XslCompiledTransform transform = new XslCompiledTransform(true);

            using (Stream xsltStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Tridion.ContentManager.Templating.Expression.NetbiscuitsFunctions.XhtmlToBBCode.xslt"))
            {
                using (XmlReader xsltReader = XmlReader.Create(xsltStream))
                {
                    transform.Load(xsltReader);
                }
            }

            StringWriter resultWriter = new StringWriter();
            XsltArgumentList argumentList = new XsltArgumentList();
            argumentList.AddParam("IncludeImages", String.Empty, outputImages);

            transform.Transform(xmlReader, argumentList, resultWriter);

            return resultWriter.ToString();   
        }
开发者ID:SGAnonymous,项目名称:sdl-tridion-world,代码行数:31,代码来源:NetbiscuitsFunctions.cs



注:本文中的System.Xml.Xsl.XsltArgumentList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Xsl.XsltContext类代码示例发布时间:2022-05-26
下一篇:
C# Xsl.XslTransform类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap