小编Dur*_*rkD的帖子

XSL完全删除注释(包括空格)

我有许多应遵循以下格式的 xml 文件:

<root>
<question>What is the answer?</question>
<answer choice="A">Some</answer>
<answer choice="B">Answer</answer>
<answer choice="C">Text</answer>
</root>
Run Code Online (Sandbox Code Playgroud)

但它来自带有注释的网络界面(我无法控制输出),最终看起来像这样:

<root>
<question>What is the answer?</question>
<answer choice="A"><!--some comment
-->
Some
</answer choice="B">
<answer>

<!--some comment
     -->
    Answer
    </answer>
    <answer choice="C"><!--another comment
    -->
   Text</answer>
   </root>
Run Code Online (Sandbox Code Playgroud)

删除注释后的输出结果如下:

What is the answer?
A\t


Some
B\t
Answer
C\t     
Text
Run Code Online (Sandbox Code Playgroud)

现在,我设置了一个 xsl 表来使用以下命令删除注释:

<xsl:template match="comment()"/>

以及其他一些身份模板应用程序。

我会使用 normalize-space(),但它会从答案文本中删除我确实想要的换行符。我正在寻找的是一种仅删除“空白”或前面和结尾的“额外”换行符的方法。有没有好的方法可以做到这一点?

另请注意:最终输出是 Adob​​e Indesign,它使用 XSLT 1.0。

[编辑 - XSL 如下]。

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:strip-space elements="*" />

<xsl:template match = …
Run Code Online (Sandbox Code Playgroud)

xml xslt whitespace

3
推荐指数
1
解决办法
7055
查看次数

捕获正在运行的进程的FlashWindowEx事件(C#)

我有一个已经运行的应用程序 - 它偶尔会触发FlashWindowEx事件(Windows 7图标闪烁).我想捕获这个事件,但我似乎无法找到任何关于如何的好信息.

我的想法是它会像这样:

  • 使用Process.GetProcessesByName连接到正在运行的进程
  • 为FlashWindowEx设置事件处理程序
  • 抓住它,做任何事情

我想我的问题是:

这可能吗?

  1. 有没有办法从正在运行的进程中获取可用事件列表?
  2. 我如何挂钩到FlashWindowEx?

谢谢

c# events winapi

3
推荐指数
1
解决办法
870
查看次数

标签 统计

c# ×1

events ×1

whitespace ×1

winapi ×1

xml ×1

xslt ×1