xml 调试 xslt 的工具

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/218522/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 12:09:36  来源:igfitidea点击:

Tools for debugging xslt

xmldebuggingxslt

提问by Jonathan Adelson

I have a Java servlet which generates xml, translates it with an xslt stylesheet, and then displays the resulting HTML. This is the first time I've worked with xslt. What's a good way to debug xslt? I have (or can get) some sample XML files to apply the transform too. But I'm not really even sure of the syntax so something that would give me syntax warnings would be great.

我有一个 Java servlet,它生成 xml,用 xslt 样式表翻译它,然后显示生成的 HTML。这是我第一次使用 xslt。调试 xslt 的好方法是什么?我也有(或可以获得)一些示例 XML 文件来应用转换。但我什至不确定语法,所以给我语法警告的东西会很棒。

采纳答案by James Sulak

Xalan should give you useful errors when you try to use an invalid XSLT. If you want something more powerful, one option for debugging XSLT is Oxygen XML Editor. It is integrated with Xalan and Saxon transform engines. Its debugging mode allows you to set breakpoints, watch variables, and provides other such basic debugging functionality. It may be overkill for you want, but it's very good.

当您尝试使用无效的 XSLT 时,Xalan 应该会给您有用的错误。如果您想要更强大的功能,调试 XSLT 的一种选择是Oxygen XML Editor。它与 Xalan 和 Saxon 转换引擎集成。它的调试模式允许您设置断点、观察变量并提供其他此类基本调试功能。这对你来说可能有点矫枉过正,但它非常好。

回答by chiborg

If you want to do "printf-style" debugging and don't want to litter your output with debugging data, use the <xsl:message>tag to generate debugging output while processing the stylesheet. With the terminate="yes"attribute you can even halt the processing of the stylesheet.

如果您想进行“printf 风格”的调试并且不想在您的输出中混入调试数据,请<xsl:message>在处理样式表时使用标记生成调试输出。使用该terminate="yes"属性,您甚至可以停止样式表的处理。

回答by Pramod

I once had to write and debug some complex XSLT documents. At the time I used debugged "printf-style" by outputting a lot of intermediate values. I later found out that there is a much easier way to do this - Altova XMLSpy. It allows you to single-step through the style-application process, watch intermediate output, etc. etc.

我曾经不得不编写和调试一些复杂的 XSLT 文档。当时我通过输出很多中间值来使用调试的“printf-style”。后来我发现有一种更简单的方法来做到这一点 - Altova XMLSpy。它允许您单步执行样式应用程序、查看中间输出等。

VS8 also has XSLT debugging support. See here: http://msdn.microsoft.com/en-us/library/ms255605(VS.80).aspx

VS8 还具有 XSLT 调试支持。请参阅此处:http: //msdn.microsoft.com/en-us/library/ms255605(VS.80).aspx

I should also mention that both XMLSpy and VS8 have syntax highlighting as well. If you specify a XSD in your XML, VS8 even gives you intellisense!

我还应该提到 XMLSpy 和 VS8 也有语法高亮显示。如果您在 XML 中指定 XSD,VS8 甚至会为您提供智能感知!

回答by Robert Rossney

I work with XSLT nearly every day, and have for six or seven years.

我几乎每天都使用 XSLT,并且已经有六七年了。

I've found that "printf-style" debugging of XSLT is so effective that I've never derived a benefit from using any other debugging mechanism (and I've tried XMLSpy and Visual Studio). It does sometimes happen that I want to be able to inspect the value of a variable and building logic that outputs it is a hassle. But that's pretty rare.

我发现 XSLT 的“printf 风格”调试非常有效,以至于我从未从使用任何其他调试机制中获益(我尝试过 XMLSpy 和 Visual Studio)。有时确实会发生这样的情况,我希望能够检查变量的值并构建输出它的逻辑很麻烦。但这非常罕见。

It may be that having a debugger would have made learningXSLT easier. (Anything would have.)

使用调试器可能会使学习XSLT 更容易。(任何东西都会有。)

回答by David Robbins

Xseleratoris s great XSL debugging tool that will:

Xselerator是一个很棒的 XSL 调试工具,它将:

  • Let you step through your XSLT dom
  • Create watch statements
  • Evaluate XPath statements against you XML DOM
  • IDE with Intellisense
  • 让您单步执行您的 XSLT dom
  • 创建监视语句
  • 针对您的 XML DOM 评估 XPath 语句
  • 带智能感知的 IDE

I've used this for years and it is a great tool.

我已经使用它多年了,它是一个很棒的工具。

回答by Javier

when learning, a syntax highlighting editor is usually enough for me (of course with the ref doc open on another window.

学习时,语法高亮编辑器对我来说通常就足够了(当然,参考文档在另一个窗口上打开。

Kate is a great editor for XML and XSLT.

Kate 是一位出色的 XML 和 XSLT 编辑器。

回答by Tamlyn

PHPStormand the other IntelliJ IDEs (commercial) support debugging XSLT. You can step through the document and see the output being generated step by step.

PHPStorm和其他 IntelliJ IDE(商业)支持调试 XSLT。您可以逐步浏览文档并查看逐步生成的输出。

回答by Pratzz

Microsoft Visual Studio is also a great tool for xslt debugger. But you must install the

Microsoft Visual Studio 也是 xslt 调试器的绝佳工具。但是你必须安装