简体   繁体   English

我们如何在 Altova XMLSpy 中报告 XSLT 错误消息?

[英]How do we report XSLT error messages in Altova XMLSpy?

The XSLT tag <xsl:message terminate="yes"> is supposed to report a message upon specified condition . XSLT 标签<xsl:message terminate="yes">应该在指定条件下报告消息。

However, Altova XMLSpy does not seem to report any messages—it's as though the tag is simply ignored.然而,Altova XMLSpy 似乎没有报告任何消息——就好像标签被简单地忽略了一样。

How do we get error reporting to work in Altova XMLSpy?我们如何让错误报告在 Altova XMLSpy 中工作?

Depending on specifically what it is you're doing, you might be able to use an XSD to validate your input prior to applying an XSLT to it, and having the XSD report errors as validation errors.具体取决于您正在做什么,您可以使用 XSD 来验证您的输入,然后再应用 XSLT 并让 XSD 将错误报告为错误。

Or, alternatively you could design a 'pre-process' XSLT that identifies and outputs errors rather than the output you're looking for, and run that first.或者,您也可以设计一个“预处理”XSLT 来识别和输出错误,而不是您正在寻找的 output,然后首先运行它。 You could probably doing that by removing any output from your existing XSLT, and substituting <xsl:message> with <xsl:text> .您可以通过从现有 XSLT 中删除任何 output 并将<xsl:message>替换为<xsl:text>来做到这一点。 To be honest though, that seems a bit of a 'hacky' way of doing it.不过老实说,这似乎有点“hacky”的方式。

Or a final possibility is simply defining and outputting an <error> element in your output, and doing a quick check for the presence of any such elements in your output, using a simple XPath query ( //error for example).或者最后一种可能性是在 output 中简单地定义和输出一个<error>元素,并使用简单的//error查询来快速检查 output 中是否存在任何此类元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM