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


C# XslCompiledTransform.Transform方法代码示例

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


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

示例1: XslCompiledTransform

// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("output.xsl");

// Create the FileStream.
using (FileStream fs = new FileStream(@"c:\data\output.xml", FileMode.Create))
{
   // Execute the transformation.
   xslt.Transform(new XPathDocument("books.xml"), null, fs);
}
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:10,代码来源:XslCompiledTransform.Transform

示例2: XslCompiledTransform

// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("output.xsl");

// Execute the transform and output the results to a file.
xslt.Transform("books.xml", "books.html");
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:6,代码来源:XslCompiledTransform.Transform

示例3: XslCompiledTransform

// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("HTML_out.xsl");

// Transform the file and output an HTML string.
string HTMLoutput;
StringWriter writer = new StringWriter();
xslt.Transform("books.xml", null, writer);
HTMLoutput = writer.ToString();
writer.Close();
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:10,代码来源:XslCompiledTransform.Transform

示例4: XslCompiledTransform

// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("output.xsl");

// Create the writer.
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = "\t";
XmlWriter writer = XmlWriter.Create("output.xml", settings);

// Execute the transformation.
xslt.Transform(new XPathDocument("books.xml"), writer);
writer.Close();
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:13,代码来源:XslCompiledTransform.Transform

示例5: XslCompiledTransform

// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("output.xsl");

// Create the writer.
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = "\t";
XmlWriter writer = XmlWriter.Create("output.xml", settings);

XmlReader reader = XmlReader.Create("books.xml");
reader.MoveToContent();

// Execute the transformation.
xslt.Transform(reader, writer);
writer.Close();
reader.Close();
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:17,代码来源:XslCompiledTransform.Transform

示例6: XslCompiledTransform

// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("output.xsl");

// Create the writer.
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = "\t";
XmlWriter writer = XmlWriter.Create("output.xml", settings);

// Execute the transformation.
xslt.Transform("books.xml", writer);
writer.Close();
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:13,代码来源:XslCompiledTransform.Transform

示例7: XmlSecureResolver

// Create a resolver and specify the necessary credentials.
XmlSecureResolver resolver = new XmlSecureResolver(new XmlUrlResolver(), "http://serverName/data/");
System.Net.NetworkCredential myCred;
myCred  = new System.Net.NetworkCredential(UserName,SecurelyStoredPassword,Domain);  
resolver.Credentials = myCred;

XsltSettings settings = new XsltSettings();
settings.EnableDocumentFunction = true;
  
// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("http://serverName/data/xsl/sort.xsl", settings, resolver);

// Transform the file.
using (XmlReader reader = XmlReader.Create("books.xml"))
{
   using (XmlWriter writer = XmlWriter.Create("output.xml")) 
   {
      xslt.Transform(reader, null, writer, resolver);
   }
}
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:21,代码来源:XslCompiledTransform.Transform

示例8: Main

//引入命名空间
using System;
using System.IO;
using System.Xml;
using System.Xml.Xsl;

public class Sample
{

    public static void Main()
    {

        // Create the XslCompiledTransform and load the stylesheet.
        XslCompiledTransform xslt = new XslCompiledTransform();
        xslt.Load("order.xsl");

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

        // Create a parameter which represents the current date and time.
        DateTime d = DateTime.Now;
        xslArg.AddParam("date", "", d.ToString());

        // Transform the file.
        using (XmlWriter w = XmlWriter.Create("output.xml"))
        {
            xslt.Transform("order.xml", xslArg, w);
        }
    }
}
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:30,代码来源:XslCompiledTransform.Transform

示例9: Main

//引入命名空间
using System;
using System.Xml.Xsl;

class MainClass {
    public static void Main() {
        XslCompiledTransform transform = new XslCompiledTransform();

        transform.Load("orders.xslt");
        transform.Transform("orders.xml", "orders.html");
    }
}
开发者ID:C#程序员,项目名称:System.Xml.Xsl,代码行数:12,代码来源:XslCompiledTransform.Transform


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