本文整理汇总了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);
}
示例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());
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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 );
}
}
}