本文整理汇总了C#中System.Xml.Xsl.XslCompiledTransform.Load方法的典型用法代码示例。如果您正苦于以下问题:C# XslCompiledTransform.Load方法的具体用法?C# XslCompiledTransform.Load怎么用?C# XslCompiledTransform.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Xsl.XslCompiledTransform
的用法示例。
在下文中一共展示了XslCompiledTransform.Load方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XmlUrlResolver
// Create a resolver and specify the necessary credentials.
XmlUrlResolver resolver = new XmlUrlResolver();
System.Net.NetworkCredential myCred;
myCred = new System.Net.NetworkCredential(UserName,SecurelyStoredPassword,Domain);
resolver.Credentials = myCred;
// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(new XPathDocument("http://serverName/data/xsl/sort.xsl"), XsltSettings.Default, resolver);
示例2: XslCompiledTransform
// Create the XslCompiledTransform object.
XslCompiledTransform xslt = new XslCompiledTransform();
// Create a resolver and set the credentials to use.
XmlSecureResolver resolver = new XmlSecureResolver(new XmlUrlResolver(), "http://serverName/data/");
resolver.Credentials = CredentialCache.DefaultCredentials;
// Load the style sheet.
xslt.Load("http://serverName/data/xsl/sort.xsl", null, resolver);
示例3: Main
//引入命名空间
using System;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.Xsl;
class Example
{
static void Main()
{
// Load a stylesheet compiled using the XSLTC.EXE utility
Type compiledStylesheet = Assembly.Load("Transform").GetType("Transform");
// Extract private members from the compiled stylesheet
BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Static;
MethodInfo executeMethod = compiledStylesheet.GetMethod("Execute", bindingFlags);
object staticData = compiledStylesheet.GetField("staticData", bindingFlags).GetValue(null);
object earlyBoundTypes = compiledStylesheet.GetField("ebTypes", bindingFlags).GetValue(null);
// Load into XslCompiledTransform
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(executeMethod, (byte[])staticData, (Type[])earlyBoundTypes);
// Run the transformation
xslt.Transform(XmlReader.Create(new StringReader("<Root><Price>9.50</Price></Root>")), (XsltArgumentList)null, Console.Out);
}
}
示例4: XslCompiledTransform
// Create the XslCompiledTransform object.
XslCompiledTransform xslt = new XslCompiledTransform();
// Create a resolver and set the credentials to use.
XmlSecureResolver resolver = new XmlSecureResolver(new XmlUrlResolver(), "http://serverName/data/");
resolver.Credentials = CredentialCache.DefaultCredentials;
XmlReader reader = XmlReader.Create("http://serverName/data/xsl/sort.xsl");
// Create the XsltSettings object with script enabled.
XsltSettings settings = new XsltSettings(false,true);
// Load the style sheet.
xslt.Load(reader, settings, resolver);
示例5: XslCompiledTransform
// Create a reader that contains the style sheet.
XmlReader reader = XmlReader.Create("titles.xsl");
reader.ReadToDescendant("xsl:stylesheet");
// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(reader);
示例6: 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");
示例7: 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");
}
}