本文整理汇总了C#中System.Xml.Xsl.XsltSettings类的典型用法代码示例。如果您正苦于以下问题:C# XsltSettings类的具体用法?C# XsltSettings怎么用?C# XsltSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XsltSettings类属于System.Xml.Xsl命名空间,在下文中一共展示了XsltSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Execute
public void Execute()
{
var xmlresolver = new BSharpXmlResolver(Project);
var xslt = new XslCompiledTransform();
var xsltsettings = new XsltSettings(true,true);
xslt.Load(_resolver.GetPath(TemplateUri),xsltsettings,xmlresolver);
var classes = _resolver.GetClasses(ClassSelector);
if (Batch)
{
var xml = new XElement("batch",classes.Select(_=>_.Compiled));
var args = BuildArgs( classes, null);
var path = _resolver.GetPath(OutputPath);
Execute(xslt,xml,args,path);
}
else
{
foreach (var cls in classes)
{
var xml = cls.Compiled;
var args = BuildArgs(classes, cls);
var path =
_resolver.GetPath(OutputPath)
.Replace("_ns_", cls.Namespace)
.Replace("_name_", cls.Name)
.Replace("_proto_", cls.Prototype);
Execute(xslt,xml,args,path);
}
}
}
开发者ID:Qorpent,项目名称:qorpent.sys,代码行数:32,代码来源:XsltTask.cs
示例2: CompileToType
public static CompilerErrorCollection CompileToType(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver, bool debug, TypeBuilder typeBuilder, string scriptAssemblyPath)
{
QilExpression expression;
if (stylesheet == null)
{
throw new ArgumentNullException("stylesheet");
}
if (typeBuilder == null)
{
throw new ArgumentNullException("typeBuilder");
}
if (settings == null)
{
settings = XsltSettings.Default;
}
if (settings.EnableScript && (scriptAssemblyPath == null))
{
throw new ArgumentNullException("scriptAssemblyPath");
}
if (scriptAssemblyPath != null)
{
scriptAssemblyPath = Path.GetFullPath(scriptAssemblyPath);
}
CompilerErrorCollection errors = new Compiler(settings, debug, scriptAssemblyPath).Compile(stylesheet, stylesheetResolver, out expression).Errors;
if (!errors.HasErrors)
{
if (GeneratedCodeCtor == null)
{
GeneratedCodeCtor = typeof(GeneratedCodeAttribute).GetConstructor(new Type[] { typeof(string), typeof(string) });
}
typeBuilder.SetCustomAttribute(new CustomAttributeBuilder(GeneratedCodeCtor, new object[] { typeof(XslCompiledTransform).FullName, "4.0.0.0" }));
new XmlILGenerator().Generate(expression, typeBuilder);
}
return errors;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:XslCompiledTransform.cs
示例3: Transformation
/// <summary>
/// Constructs a <b>Transformation</b> instance using the XSL source
/// in the specified file.
/// </summary>
/// <param name="filename">The XSL filename.</param>
public Transformation(string filename)
{
XsltSettings settings = new XsltSettings();
settings.EnableScript = true;
transformer.Load (Application.PathTo (filename), settings, null);
}
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:12,代码来源:Transformation.cs
示例4: Svg2Xaml
public static string Svg2Xaml(string svgFileName)
{
try
{
if (File.Exists(svgFileName) == false || File.Exists(Svg2XamlXslFile) == false)
return null;
var xslt = new XslCompiledTransform();
var settings = new XsltSettings(true, true);
xslt.Load(Svg2XamlXslFile, settings, new XmlUrlResolver());
var xamlOfSvg = new StringBuilder();
var xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.ConformanceLevel = ConformanceLevel.Document;
xmlReaderSettings.DtdProcessing = DtdProcessing.Ignore;
using (var xmlReader = XmlReader.Create(svgFileName, xmlReaderSettings))
using (var xmlWriter = XmlWriter.Create(xamlOfSvg))
{
xslt.Transform(xmlReader, xmlWriter);
return xamlOfSvg.ToString();
}
}
catch (Exception e)
{
Logger.Error(e, "ImageConverters.Svg2Xaml");
return null;
}
}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:28,代码来源:SVGConverter.cs
示例5: LoadXslt
/// <summary>
/// Loads the XSLT file using specified path, settings and stylesheet resolver.
/// </summary>
/// <param name="path">The URL to the XSLT file.</param>
/// <param name="settings">XSLT settings.</param>
/// <param name="stylesheetResolver">The stylesheet resolver.</param>
/// <returns><see cref="XslCompiledTransform" /> object that can transform the input.</returns>
public virtual XslCompiledTransform LoadXslt(string path, XsltSettings settings, XmlResolver stylesheetResolver)
{
var xslt = new XslCompiledTransform();
xslt.Load(path, settings, stylesheetResolver);
return xslt;
}
开发者ID:whyleee,项目名称:EPiTranslator-old,代码行数:14,代码来源:XmlHelper.cs
示例6: CreateCodeBaseXML
public void CreateCodeBaseXML()
{
try
{
package = Package.Open(fileCodeBase);
XmlDocument sharedString = GetPartFile(OfficeFilePart.ShareString, 0);
sharedString.Save(Common.SHARED_STRING);
XmlDocument sheet = GetPartFile(OfficeFilePart.Sheet, 1);
XsltArgumentList xsltArgListSheet = new XsltArgumentList();
XsltSettings settings = new XsltSettings(true, true);
XslCompiledTransform xslTransSheet = new XslCompiledTransform();
xslTransSheet.Load(Common.XSLT_CODE_BASE, settings, new XmlUrlResolver());
xsltArgListSheet.AddParam("prmDocSharedStrings", "", sharedString.CreateNavigator());
string sOutXmlSheet = System.String.Empty;
using (FileStream fs = new FileStream(Common.XML_CODE_BASE, FileMode.Create))
{
xslTransSheet.Transform(sheet.CreateNavigator(), xsltArgListSheet, fs);
}
XslCompiledTransform xslRowSheet = new XslCompiledTransform();
xslRowSheet.Load(Common.XSLT_TO_ROW);
xslRowSheet.Transform(Common.XML_CODE_BASE, Common.XML_ROW);
}
finally
{
package.Close();
}
}
开发者ID:weerci,项目名称:askme-one,代码行数:31,代码来源:OfficeConvert.cs
示例7: Transform
public void Transform()
{
var xsltTemplateReader = new XmlTextReader(_xsltPath);
var emptyDocumentReader = XmlReader.Create(new System.IO.StringReader("<empty />"));
var settings = new XmlWriterSettings();
//settings.ConformanceLevel = ConformanceLevel.Fragment;
settings.Indent = true;
using (var outputWriter = XmlWriter.Create(_outputPath, settings))
{
var xsltSettings = new XsltSettings();
XsltArgumentList argumentList = new XsltArgumentList();
var extensions = new XsltExtensionMethods(_settings);
argumentList.AddExtensionObject("http://core.com/config", extensions);
argumentList.AddExtensionObject("http://paralect.com/config", extensions);
var transformer = new XslCompiledTransform(true);
transformer.Load(xsltTemplateReader, xsltSettings, null);
transformer.Transform(emptyDocumentReader,argumentList, outputWriter);
}
}
开发者ID:paralect,项目名称:Paralect.Config,代码行数:25,代码来源:XsltTransformer.cs
示例8: ToHtml
private string ToHtml()
{
if (Services.StrandsCache.Contains(this))
{
return Services.StrandsCache.Read(this);
}
else
{
var transform = new XslCompiledTransform(true);
var arguments = new XsltArgumentList();
var settings = new XsltSettings();
var readersettings = new XmlReaderSettings();
//string xslsrc = (!string.IsNullOrEmpty(this.DisplayType)) ? "/XMLList.xsl" : "/Strands.xsl";
//var xslfile = (this.Name == "themes") ? HttpContext.Current.Server.MapPath(this._xslAppUrl + "/StrandList.xsl") : HttpContext.Current.Server.MapPath(this._xslAppUrl + xslsrc);
var xslfile = HttpContext.Current.Server.MapPath(this._xslAppUrl + ((!string.IsNullOrEmpty(this.DisplayType)) ? "XMLList.xsl" : this.XslName));
settings.EnableDocumentFunction = true;
settings.EnableScript = true;
readersettings.DtdProcessing = DtdProcessing.Parse;
readersettings.ValidationType = ValidationType.None;
transform.Load(xslfile, settings, new XmlUrlResolver());
arguments = TransformArguments(this);
using (XmlReader reader = XmlReader.Create(this.GetDirectoryPath(), readersettings))
{
System.IO.StringWriter writer = new System.IO.StringWriter();
transform.Transform(reader, arguments, writer);
return Services.StrandsCache.Write(this, writer.ToString());
}
}
}
开发者ID:jbunzel,项目名称:MvcStrands_git,代码行数:31,代码来源:StrandsRepository.cs
示例9: SparqlXsltWriter
/// <summary>
/// Creates a new SPARQL XSLT Writer
/// </summary>
/// <param name="stylesheetUri">Stylesheet URI</param>
public SparqlXsltWriter(String stylesheetUri)
{
//Load the Transform
this._transform = new XslCompiledTransform();
XsltSettings settings = new XsltSettings();
this._transform.Load(stylesheetUri, settings, null);
}
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:11,代码来源:SparqlXsltWriter.cs
示例10: News
/// <summary>
/// Initializes a new instance of the <see cref="News"/> class.
/// </summary>
/// <param name="RssFeedTransformer">The RSS feed transformer.</param>
/// <remarks>Documented by Dev02, 2007-11-28</remarks>
public News(string RssFeedTransformer)
{
XmlDocument rssFeedTransformer = new XmlDocument();
XsltSettings settings = new XsltSettings(false, true); //disable scripts and enable document()
rssFeedTransformer.LoadXml(RssFeedTransformer);
xslTransformer.Load(rssFeedTransformer.CreateNavigator(), settings, new XmlUrlResolver());
}
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:12,代码来源:News.cs
示例11: LoadXmlTestResult
protected override XmlDocument LoadXmlTestResult()
{
//transform MsTest result to nunit and return
xmlTestResultDoc = new XmlDocument();
xmlTestResultDoc.Load(reportParameters.XmlTestResult);
namespaceURI = xmlTestResultDoc.SelectSingleNode("/*").NamespaceURI;
var nameTable = GetNameTable();
XslCompiledTransform xslt = new XslCompiledTransform();
using (var xsltReader = new ResourceXmlReader(typeof(MsTestExecutionReportGenerator), "MsTestToNUnit.xslt", nameTable))
{
var resourceResolver = new XmlResourceResolver();
var xsltSettings = new XsltSettings(true, false);
xslt.Load(xsltReader, xsltSettings, resourceResolver);
}
var writerStream = new MemoryStream();
using (var xmlTextWriter = new XmlTextWriter(writerStream, Encoding.UTF8))
{
xslt.Transform(xmlTestResultDoc, xmlTextWriter);
}
writerStream = new MemoryStream(writerStream.GetBuffer());
XmlDocument result = new XmlDocument();
result.Load(writerStream);
return result;
}
开发者ID:BEllis,项目名称:SpecFlow,代码行数:28,代码来源:MsTestExecutionReportGenerator.cs
示例12: Transform
/// <summary>
/// Performs a XSL Transformation
/// </summary>
/// <param name="styleSheet">Style Sheet path relative to Application Base directory</param>
/// <param name="xslArguments">XSL Arguments</param>
/// <param name="inputStream">Input Stream</param>
/// <param name="outputStream">Out put Stream as Ref (output Stream is initialized if it is null</param>
public void Transform(String styleSheet, Dictionary<String, String> xslArguments, Stream inputStream, ref Stream outputStream)
{
try
{
XsltSettings xsltSettings = new XsltSettings();
xsltSettings.EnableScript = true;
xsltSettings.EnableDocumentFunction = true;
XsltArgumentList xslArgumentList = new XsltArgumentList();
foreach (String key in xslArguments.Keys)
{
xslArgumentList.AddParam(key, "", xslArguments[key]);
}
XslCompiledTransform transformer = new XslCompiledTransform();
String stylesheetpath = AppDomain.CurrentDomain.BaseDirectory + styleSheet;
transformer.Load(stylesheetpath, xsltSettings, new XmlUrlResolver());
if (null == outputStream)
{
outputStream = new MemoryStream();
}
StreamWriter streamWriter = new StreamWriter(outputStream);
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.DtdProcessing = DtdProcessing.Ignore;
XmlReader xmlReader = XmlReader.Create(inputStream, xmlReaderSettings);
XmlTextWriter writer = new XmlTextWriter(outputStream,System.Text.Encoding.UTF8);
writer.Formatting = Formatting.None;
transformer.Transform(xmlReader, xslArgumentList, writer);
}
catch (Exception exception)
{
throw exception;
}
}
开发者ID:xchgdzq233,项目名称:testing,代码行数:42,代码来源:XSLUtility.cs
示例13: Main
static void Main(string[] args)
{
if (args.Length != 3)
{
Console.WriteLine("You have not entered the correct parameters");
return;
}
string xmlfile = args[0];
string xslfile = args[1];
string outfile = args[2];
try
{
var doc = new XPathDocument(xmlfile);
var transform = new XslCompiledTransform();
var settings = new XsltSettings(true, true);
transform.Load(xslfile, settings, new XmlUrlResolver());
var writer = new XmlTextWriter(outfile, null);
transform.Transform(doc, null, writer);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
}
}
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:27,代码来源:Program.cs
示例14: TransformHtml
public static void TransformHtml(XmlSerializer serializer, object report, Type reportType, string outputFilePath, GeneratorConfiguration generatorConfiguration, string xsltFile)
{
var xmlOutputWriter = new StringWriter();
serializer.Serialize(xmlOutputWriter, report);
XslCompiledTransform xslt = new XslCompiledTransform();
var xsltSettings = new XsltSettings(true, false);
XmlResolver resourceResolver;
var reportName = reportType.Name.Replace("Generator", "");
using (var xsltReader = GetTemplateReader(reportType, reportName, xsltFile))
{
resourceResolver = new XmlResourceResolver();
xslt.Load(xsltReader, xsltSettings, resourceResolver);
}
var xmlOutputReader = new XmlTextReader(new StringReader(xmlOutputWriter.ToString()));
XsltArgumentList argumentList = new XsltArgumentList();
argumentList.AddParam("feature-language", "", generatorConfiguration.FeatureLanguage.Name);
argumentList.AddParam("tool-language", "", generatorConfiguration.ToolLanguage.Name);
using (var xmlTextWriter = new XmlTextWriter(outputFilePath, Encoding.UTF8))
{
xslt.Transform(xmlOutputReader, argumentList, xmlTextWriter, resourceResolver);
}
}
开发者ID:BEllis,项目名称:SpecFlow,代码行数:27,代码来源:XsltHelper.cs
示例15: Transform
public void Transform(string inputFilePath, string outputFilePath, KeyValueConfigurationCollection settings)
{
var xsltTemplateReader = new XmlTextReader(inputFilePath);
var emptyDocumentReader = XmlReader.Create(new System.IO.StringReader("<empty />"));
var writerSettings = new XmlWriterSettings();
//settings.ConformanceLevel = ConformanceLevel.Fragment;
writerSettings.Indent = true;
using (var outputWriter = XmlWriter.Create(outputFilePath, writerSettings))
{
var xsltSettings = new XsltSettings();
XsltArgumentList argumentList = new XsltArgumentList();
var extensions = new XsltExtensionMethods(settings);
argumentList.AddExtensionObject("http://core.com/config", extensions);
argumentList.AddExtensionObject("http://setty.net/config", extensions);
var transformer = new XslCompiledTransform(true);
transformer.Load(xsltTemplateReader, xsltSettings, null);
transformer.Transform(emptyDocumentReader, argumentList, outputWriter);
}
}
开发者ID:paralect,项目名称:setty,代码行数:25,代码来源:XsltTransformer.cs
示例16: XMLToHtml
public void XMLToHtml()
{
var xsl = new XslCompiledTransform();
var settings = new XsltSettings { EnableScript = true };
xsl.Load("../../bookhtml.xslt", settings, null);
xsl.Transform("../../books.xml", "../../result.html");
}
开发者ID:maximkharaneka,项目名称:Mentoring,代码行数:8,代码来源:Tasks.cs
示例17: GenerateRss
public void GenerateRss()
{
var xsl = new XslCompiledTransform();
var settings = new XsltSettings { EnableScript = true };
xsl.Load("../../bookrss.xslt", settings, null);
xsl.Transform("../../books.xml", "../../resultrss.xml");
}
开发者ID:maximkharaneka,项目名称:Mentoring,代码行数:8,代码来源:Tasks.cs
示例18: XslCompiler
/// <summary>
/// Initializes a new instance of the <see cref="XslCompiler">XslCompiler</see> class.
/// </summary>
public XslCompiler(string path, string assemblyFilename)
{
Path = path;
Filename = assemblyFilename;
TargetProcessor = ImageFileMachine.I386;
XsltSettings = new XsltSettings();
XmlResolver = new XmlUrlResolver();
XmlResolver.Credentials = CredentialCache.DefaultCredentials;
}
开发者ID:yetanotherchris,项目名称:crispy-succotash,代码行数:12,代码来源:XslCompiler.cs
示例19: Execute
public IIR Execute(IIR predecessorIR)
{
var xmlIR = predecessorIR as XmlIR;
if (xmlIR == null)
{
MessageEngine.Trace(Severity.Error, Resources.ErrorPhaseWorkflowIncorrectInputIRType, predecessorIR.GetType().ToString(), Name);
}
var xsltFileList = new List<string>();
string xsltFolderPath = PathManager.GetToolSubpath(Settings.Default.SubPathXsltTransformFolder);
foreach (string xsltFile in _xsltFiles.Split(';'))
{
if (!String.IsNullOrEmpty(xsltFile))
{
xsltFileList.Add(Path.Combine(xsltFolderPath, xsltFile));
}
}
var settings = new XsltSettings(true, false);
var output = new XmlIR();
// REVIEW: The approach I take here is to pipeline XSLT transforms using a MemoryStream. This isn't great.
// In the next .NET Fx, they are expecting to fix XslCompiledTransform so it can pipeline more resonably. This should be changed at that time.
foreach (BimlFile bimlFile in xmlIR.BimlFiles)
{
XDocument document = bimlFile.XDocument;
var intermediateXmlDocument = new XmlDocument();
intermediateXmlDocument.Load(document.CreateReader());
if (!String.IsNullOrEmpty(xmlIR.TemplatePath))
{
foreach (string s in xsltFileList)
{
var xslt = new XslCompiledTransform();
var args = new XsltArgumentList();
args.AddParam("TemplatePath", String.Empty, xmlIR.TemplatePath);
xslt.Load(s, settings, new XmlUrlResolver());
var intermediateMemoryStream = new MemoryStream();
xslt.Transform(intermediateXmlDocument, args, intermediateMemoryStream);
intermediateMemoryStream.Position = 0;
intermediateXmlDocument = new XmlDocument();
intermediateXmlDocument.Load(intermediateMemoryStream);
}
}
output.AddXml(bimlFile.FilePath, intermediateXmlDocument, bimlFile.EmitType, true);
}
output.SchemaSet = xmlIR.SchemaSet;
output.DefaultXmlNamespace = xmlIR.DefaultXmlNamespace;
return output;
}
开发者ID:japj,项目名称:vulcan,代码行数:56,代码来源:XmlXsltTransformPhase.cs
示例20: LoadFromPath
/// <summary>
/// This should be a part of the I/O layer
/// </summary>
public static void LoadFromPath(this XslCompiledTransform xslCompiledTransform, string path, XsltSettings settings, XmlResolver stylesheetResolver)
{
using (C1StreamReader streamReader = new C1StreamReader(path))
{
using (XmlReader xmlReader = XmlReader.Create(streamReader))
{
xslCompiledTransform.Load(xmlReader, settings, stylesheetResolver);
}
}
}
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:13,代码来源:XslCompiledTransformUtils.cs
注:本文中的System.Xml.Xsl.XsltSettings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论