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