我有一个包含许多NUnit测试的项目.我很高兴这些测试包含在Debug配置构建中,但我想删除对nunit.framework的依赖,以解决Release配置问题.有没有办法排除特定(发布)配置的NUnit引用和nunit测试对象?我正在使用Sharp Develop,但我很好奇你如何使用Visual Studio解决这个问题.
有线索吗?
我正在使用大约十几个XSLT文件来提供大量的输出格式.目前,用户必须知道要导出的文件格式的扩展名,例如RTF,HTML,TXT.
我还想使用参数来允许更多选项.如果我可以将元数据嵌入到XSL文件中,那么我可以通过扫描文件来获取详细信息.
这是我在想的.在此示例中,程序必须解析所需信息的注释.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Title: Export to Rich Text Format -->
<!-- Description: This Stylesheet converts to a Rich Text Format format which may be used in a word processor such as Word -->
<!-- FileFormat: RTF -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="CompanyName"/> <!-- Format:String, Description: Company name to be inserted in the footer -->
<xsl:param name="DateDue"/> <!-- Format:Date-yyyy-mm-dd, Description: Date Due -->
<xsl:param name="IncludePicture">true</xsl:param><!-- Format:Boolean, Description: Do you want to include a graphical representation? -->
<xsl:template …Run Code Online (Sandbox Code Playgroud) <xsl:apply-templates select="element[child='Yes']">
Run Code Online (Sandbox Code Playgroud)
工作正常,但我想使用
<xsl:apply-templates select="element[$childElementName='Yes']">
Run Code Online (Sandbox Code Playgroud)
所以我可以使用变量来指定节点.
例如
<xsl:apply-templates select="theList/entity[Central='Yes']">
Run Code Online (Sandbox Code Playgroud)
适用于:
<?xml version="1.0" encoding="utf-8"?>
<theList>
<entity>
<Business-Name>Company 1</Business-Name>
<Phone-Number>123456</Phone-Number>
<Central>Yes</Central>
<region1>No</region1>
<region2>Yes</region2>
<region3>No</region3>
<Northern>No</Northern>
</entity>
<entity>
<Business-Name>Company 2</Business-Name>
<Phone-Number>123456</Phone-Number>
<Central>No</Central>
<region1>Yes</region1>
<region2>No</region2>
<region3>No</region3>
<Northern>Yes</Northern>
</entity>
<entity>
<Business-Name>Company 3</Business-Name>
<Phone-Number>123456</Phone-Number>
<Central>Yes</Central>
<region1>No</region1>
<region2>No</region2>
<region3>No</region3>
<Northern>No</Northern>
</entity>
<entity>
<Business-Name>Company 4</Business-Name>
<Phone-Number>123456</Phone-Number>
<Central>No</Central>
<region1>No</region1>
<region2>No</region2>
<region3>No</region3>
<Northern>No</Northern>
</entity>
</theList>
Run Code Online (Sandbox Code Playgroud)
但我不想硬编码子元素名称.
有什么建议?
感谢蒂姆的回答:
<xsl:apply-templates select="theList/entity[child::*[name()=$childElement]='Yes']" />
Run Code Online (Sandbox Code Playgroud) 我已将winforms html 编辑器中的代码改编为 C#(见下文)。是否可以使用 CKEditor 代替?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WebEditorTest
{
/// <summary>
/// /sf/ask/14988711/
/// </summary>
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("about:blank");
Application.DoEvents();
webBrowser1.Document.OpenNew(false).Write("<html><body><div id=\"editable\">Edit this text</div></body></html>");
foreach (HtmlElement el in webBrowser1.Document.All)
{
el.SetAttribute("unselectable", "on");
el.SetAttribute("contenteditable", "false");
}
foreach (HtmlElement el in webBrowser1.Document.All.GetElementsByName("editable"))
{
el.SetAttribute("width", webBrowser1.Width + "px");
el.SetAttribute("height", …Run Code Online (Sandbox Code Playgroud)