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


C# XslTransform.Load方法代码示例

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


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

示例1: TransformFile

public static void TransformFile (XPathNavigator xsltNav) {
 
 // Load the stylesheet. 
 XslTransform xslt = new XslTransform();
 xslt.Load(xsltNav, null, null);

 // Transform the file.
 xslt.Transform("books.xml", "books.html", null);
}
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:9,代码来源:XslTransform.Load

示例2: TransformFile

public static void TransformFile (XmlReader xsltReader, String secureURL) {
 
 // Load the stylesheet using a default XmlUrlResolver and Evidence 
 // created using the trusted URL.
 XslTransform xslt = new XslTransform();
 xslt.Load(xsltReader, new XmlUrlResolver(), XmlSecureResolver.CreateEvidenceForUrl(secureURL));

 // Transform the file.
 xslt.Transform("books.xml", "books.html", new XmlUrlResolver());
}
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:10,代码来源:XslTransform.Load

示例3: Main

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

public class Sample
{
  private const String filename = "books.xml";
  private const String stylesheet = "titles.xsl";

  public static void Main()
  {
    //Create the reader to load the stylesheet. 
    //Move the reader to the xsl:stylesheet node.
    XmlTextReader reader = new XmlTextReader(stylesheet);
    reader.Read();
    reader.Read();

    //Create the XslTransform object and load the stylesheet.
    XslTransform xslt = new XslTransform();
    xslt.Load(reader);

    //Load the file to transform.
    XPathDocument doc = new XPathDocument(filename);
             
    //Create an XmlTextWriter which outputs to the console.
    XmlTextWriter writer = new XmlTextWriter(Console.Out);

    //Transform the file and send the output to the console.
    xslt.Transform(doc, null, writer);
    writer.Close();  
  }
}
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:35,代码来源:XslTransform.Load

示例4: Main

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

public class Sample
{
  private const String filename = "books.xml";
  private const String stylesheet = "output.xsl";

  public static void Main()
  {
    //Load the stylesheet.
    XslTransform xslt = new XslTransform();
    xslt.Load(stylesheet);

    //Load the file to transform.
    XPathDocument doc = new XPathDocument(filename);
             
    //Create an XmlTextWriter which outputs to the console.
    XmlTextWriter writer = new XmlTextWriter(Console.Out);

    //Transform the file and send the output to the console.
    xslt.Transform(doc, null, writer, null);
    writer.Close();
  }
}
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:29,代码来源:XslTransform.Load

示例5: Main

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

public class Sample
{
   private const String filename = "books.xml";
   private const String stylesheet = "sort.xsl";

   public static void Main()
   {
      //Create the XslTransform.
     XslTransform xslt = new XslTransform();

     //Create a resolver and set the credentials to use.
     XmlUrlResolver resolver = new XmlUrlResolver();
     resolver.Credentials = CredentialCache.DefaultCredentials;
  
     //Load the stylesheet.
     xslt.Load(stylesheet, resolver);

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

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

     //Transform the file.
     xslt.Transform(doc, null, writer, null);
     writer.Close();
  }
}
开发者ID:.NET开发者,项目名称:System.Xml.Xsl,代码行数:36,代码来源:XslTransform.Load

示例6: Main

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

public class MainClass {
   public static void Main() {
      try
      {
        XPathDocument doc = new XPathDocument( "Sample.xml" );

        StringWriter sw = new StringWriter();
        XmlTextWriter tw = new XmlTextWriter( sw );
        tw.Formatting = Formatting.Indented;
        tw.Indentation = 4;

        XslTransform tr = new XslTransform();
        tr.Load( "test.xslt" );

        tr.Transform( doc.CreateNavigator(), null, tw );
    
        tw.Close();
        sw.Close();
      }
      catch( Exception exc )
      {
          Console.WriteLine( exc.Message );
      }
    }
}
开发者ID:C#程序员,项目名称:System.Xml.Xsl,代码行数:34,代码来源:XslTransform.Load


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