当前位置: 首页>>代码示例>>C#>>正文


C# XsltArgumentList.AddParam方法代码示例

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


在下文中一共展示了XsltArgumentList.AddParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateSinglePage

        private void GenerateSinglePage(string kind, string kindName, string name, string slug, string title)
        {
            string filename = Path.Combine(this.OutputDirectory, slug + "." + this.FileSuffix);

            Dictionary<string, XElement> inputXml = new Dictionary<string, XElement>();

            var type = inputDocument.Elements("type").Where(c => c.Attribute("kind").Value == kind && c.Attribute("name").Value == name).Single();

            InsertExamples(type);

            using (var reader = inputDocument.CreateReader())
            {
                using (XmlWriter writer = XmlWriter.Create(filename + ".tmp", new XmlWriterSettings { OmitXmlDeclaration = true }))
                {
                    XsltArgumentList arguments = new XsltArgumentList();
                    arguments.AddParam("kind", "", kind);
                    arguments.AddParam("kindName", "", kindName);
                    arguments.AddParam("name", "", name);
                    arguments.AddParam("slug", "", slug);
                    arguments.AddParam("mode", "", this.Mode);
                    transform.Transform(reader, arguments, writer);
                }
            }

            PostProcessFile(filename + ".tmp");
            RewriteIfChanged(filename);
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:27,代码来源:DocPageGenerator.cs

示例2: CreateResultPage

		public string CreateResultPage(XDocument result, bool isTrace)
		{
			var args = new XsltArgumentList();
			args.AddParam("prmHCTraceLoadErrorFile", "", Path.Combine(Path.GetTempPath(), m_cache.ProjectId.Name + "HCLoadErrors.xml"));
			args.AddParam("prmShowTrace", "", isTrace.ToString().ToLowerInvariant());
			return TraceTransform.Transform(m_mediator, result, isTrace ? "HCTrace" : "HCParse", args);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:7,代码来源:HCTrace.cs

示例3: DrawProfilesModule

        private void DrawProfilesModule()
        {
            XsltArgumentList args = new XsltArgumentList();
            XslCompiledTransform xslt = new XslCompiledTransform();
            SessionManagement sm = new SessionManagement();

            Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO();
            string email = string.Empty;
            string imageemailurl = string.Empty;
            if (this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces) != null &&
                this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/vivo:email", this.Namespaces) == null)
            {
                email = this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces).InnerText;
                imageemailurl = string.Format(Root.Domain + "/profile/modules/CustomViewPersonGeneralInfo/" + "EmailHandler.ashx?msg={0}", HttpUtility.UrlEncode(email));
            }

            args.AddParam("root", "", Root.Domain);
            if (email != string.Empty)
            {
                args.AddParam("email", "", imageemailurl);
            }
            args.AddParam("imgguid", "", Guid.NewGuid().ToString());

            litPersonalInfo.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/CustomViewPersonGeneralInfo/CustomViewPersonGeneralInfo.xslt"), args, base.BaseData.OuterXml);

            if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces) != null)
            {
                string imageurl = base.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces).Value;
                imgPhoto.ImageUrl = imageurl + "&cachekey=" + Guid.NewGuid().ToString();
            }
            else
            {
                imgPhoto.Visible = false;
            }
        }
开发者ID:kousij,项目名称:ProfilesRNS,代码行数:35,代码来源:CustomViewPersonGeneralInfo.ascx.cs

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: TransformXml

        protected override void TransformXml(XPathDocument document, XmlTextWriter writer)
        {
			XsltArgumentList args = new XsltArgumentList();
			args.AddParam("separate-fixtures", "", (this.GenerateFixtureInSeparateFile) ? 1 : 0);
            args.AddParam("show-fixtures-summary", "", (this.ShowFixturesSummary) ? 1 : 0);
            args.AddParam("creation-time", "", this.CreationTime.ToString("u"));

			if (this.GenerateFixtureInSeparateFile)
				this.GenerateFixtureReports(document, args);

            UnitResourceManager.HtmlReport.Transform(document, args, writer);
            writer.Close();

        }
开发者ID:sayedjalilhassan,项目名称:LearningPlatform,代码行数:14,代码来源:UnitTestHtmlReport.cs

示例10: BuildUploadXML

        protected override XElement BuildUploadXML()
        {
            // Get and transform this effectively does basic format validation
            XElement results = this.GetWorksheetXML(0, HttpContext.Current.Server.MapPath(@"~\Xslt\Senior\SeniorResults.xslt"));

            // Unify and return
            XsltArgumentList xal = new XsltArgumentList();

            // Set some other parameters
            xal.AddParam("fileName", "", this.Filename);
            xal.AddParam("tournamentId", "", this.TournamentId);

            XElement transformed = XElement.Parse(Utility.Transform(results.ToString(), HttpContext.Current.Server.MapPath(@"~\Xslt\Senior\Senior.xslt"), xal));
            return transformed;
        }
开发者ID:CaffGeek,项目名称:manitobamasterbowlers.com,代码行数:15,代码来源:Upload.Senior.cs

示例11: DrawProfilesModule

        private void DrawProfilesModule()
        {
            XsltArgumentList args = new XsltArgumentList();
            args.AddParam("root", "", Root.Domain);

            litPublication.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/CustomViewInformationResource/CustomViewInformationResource.xslt"), args, base.BaseData.OuterXml);
        }
开发者ID:CTSIatUCSF,项目名称:ProfilesRNS10x-OpenSocial,代码行数:7,代码来源:CustomViewInformationResource.ascx.cs

示例12: Parse

		public static void Parse(
			XmlDocument		xmlMetadata_in, 
			string			xsltTemplateURL_in, 
			Hashtable		xsltParameters_in, 

			StringWriter	parsedOutput_in
		) {
			#region XsltArgumentList _xsltparameters = new XsltArgumentList().AddParam(...);
			XsltArgumentList _xsltparameters = new XsltArgumentList();
			IDictionaryEnumerator _denum = xsltParameters_in.GetEnumerator();
			_denum.Reset();
			while (_denum.MoveNext()) {
				_xsltparameters.AddParam(
					_denum.Key.ToString(), 
					"", 
					System.Web.HttpUtility.UrlEncode(
						_denum.Value.ToString()
					)
				);
			}
			#endregion

			XPathNavigator _xpathnav = xmlMetadata_in.CreateNavigator();
			XslTransform _xslttransform = new XslTransform();
			_xslttransform.Load(
				xsltTemplateURL_in
			);
			_xslttransform.Transform(
				_xpathnav, 
				_xsltparameters, 
				parsedOutput_in, 
				null
			);
		}
开发者ID:katshann,项目名称:ogen,代码行数:34,代码来源:ParserXSLT.cs

示例13: Do

        /// <summary>
        /// выполнить конвертацию структуры
        /// </summary>
        public void Do()
        {
            try
            {
                SendMessage("\n- Конвертация структуры курса");
                XDocument doc = new XDocument(course);
                doc.Document.Declaration = new XDeclaration("1.0", "utf-8", "true");
                XPathNavigator nv = doc.CreateNavigator();

                XslCompiledTransform xslt = new XslCompiledTransform();

                xslt.Load(convParams.ContentShemePath);

                XsltArgumentList xslArg = new XsltArgumentList();
                xslArg.AddParam("itemsPath", "", convParams.RootFolderName);

                string outFile = Path.Combine(convParams.OutputAbsPath, convParams.StartFileName);

                using (FileStream fs = new FileStream(outFile, FileMode.Create))
                {
                    xslt.Transform(nv, xslArg, fs);
                }
            }
            catch(Exception ex)
            {
                LastError = ex.Message;
                throw new Exception("Исключение при конвертации структуры курса: "+ex.Message);
            }
        }
开发者ID:Tanvas,项目名称:convertorXML2HTML,代码行数:32,代码来源:ContentXSLTConvertor.cs

示例14: Index

 public ActionResult Index()
 {
     HttpServerUtilityBase server = base.HttpContext.Server;
     HttpResponseBase response = base.HttpContext.Response;
     HttpRequestBase request = base.HttpContext.Request;
     IContainerAccessor applicationInstance = base.HttpContext.ApplicationInstance as IContainerAccessor;
     this.Logger.Debug("GoogleSitemap handler >>>>>>>>>>>>>>>>>>");
     string url = string.Format("http://{0}", request.Url.Host.ToLower()) + ((request.Url.Port != 80) ? (":" + request.Url.Port) : "");
     url = this.AdjustUrlToContext(url);
     XsltArgumentList arguments = new XsltArgumentList();
     arguments.AddParam("domain", "", url);
     try
     {
         string siteMapFile = WebConfiguration.Current.SiteMapFile;
         this.Logger.DebugFormat("GoogleSitemap config sitemap file {0}", new object[] { siteMapFile });
         string uri = server.MapPath(siteMapFile);
         this.Logger.DebugFormat("GoogleSitemap mapped sitemap file {0}", new object[] { uri });
         XPathDocument document = new XPathDocument(uri);
         XslCompiledTransform transform = new XslCompiledTransform();
         EmbeddedResourceResolver stylesheetResolver = new EmbeddedResourceResolver();
         transform.Load("Coats.Crafts.google-sitemap.xsl", XsltSettings.TrustedXslt, stylesheetResolver);
         StringWriter w = new StringWriter();
         XmlTextWriter writer2 = new XmlTextWriter(w);
         transform.Transform((IXPathNavigable) document, arguments, (XmlWriter) writer2);
         return this.Content(w.ToString(), "text/xml", Encoding.UTF8);
     }
     catch (Exception exception)
     {
         this.Logger.Error("Error rendering Google Sitemap XSLT", exception);
     }
     return base.Content("Error creating Google Sitemap");
 }
开发者ID:pjbeemster,项目名称:scratchpad,代码行数:32,代码来源:GoogleSiteMapController.cs

示例15: split

        public void split()
        {
            System.Xml.Xsl.XslCompiledTransform trans = new System.Xml.Xsl.XslCompiledTransform();
            //XsltSettings settings = new XsltSettings(false, true);

            string xsltFile = @"C:\Users\yxzhk\WorkSpace\CodeDemo\CsPoc\CsPoc\XML\split.xsl";

            using (StreamReader rdr = new StreamReader(xsltFile))
            {
                using (XmlReader xmlRdr = XmlReader.Create(rdr))
                {
                    trans.Load(xmlRdr);
                }
            }

            string inputFile = @"C:\Users\yxzhk\WorkSpace\CodeDemo\CsPoc\CsPoc\XML\split.xml";
            string outputFile = @"C:\Users\yxzhk\WorkSpace\CodeDemo\CsPoc\CsPoc\XML\split-out.xml";

            XsltArgumentList xslArg = new XsltArgumentList();
            xslArg.AddParam("tag", "", "ItemA,ItemB,ItemC");

            //trans.Transform(inputFile,outputFile);

            using (XmlWriter w = XmlWriter.Create(outputFile))
            {
                trans.Transform(inputFile, xslArg, w);
            }
        }
开发者ID:HK-Zhang,项目名称:Grains,代码行数:28,代码来源:XsltBasic.cs


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