我有许多应遵循以下格式的 xml 文件:
Run Code Online (Sandbox Code Playgroud)<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
现在,我设置了一个 xsl 表来使用以下命令删除注释:
<xsl:template match="comment()"/>
以及其他一些身份模板应用程序。
我会使用 normalize-space(),但它会从答案文本中删除我确实想要的换行符。我正在寻找的是一种仅删除“空白”或前面和结尾的“额外”换行符的方法。有没有好的方法可以做到这一点?
另请注意:最终输出是 Adobe Indesign,它使用 XSLT 1.0。
[编辑 - XSL 如下]。
Run Code Online (Sandbox Code Playgroud)<?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 = …
我有一个已经运行的应用程序 - 它偶尔会触发FlashWindowEx事件(Windows 7图标闪烁).我想捕获这个事件,但我似乎无法找到任何关于如何的好信息.
我的想法是它会像这样:
我想我的问题是:
这可能吗?
谢谢