我们如何在 Altova XMLSpy 中报告 XSLT 错误消息?
XSLT 标记
应该在指定的条件上报告消息。
然而,Altova XMLSpy 似乎没有报告任何消息,就好像该标记被简单地忽略了一样。
我们如何让错误报告在 Altova XMLSpy 中发挥作用?
The XSLT tag <xsl:message terminate="yes">
is supposed to report a message upon specified condition.
However, Altova XMLSpy does not seem to report any messages—it's as though the tag is simply ignored.
How do we get error reporting to work in Altova XMLSpy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您正在执行的具体操作,您可能能够在应用 XSLT 之前使用 XSD 来验证您的输入,并使 XSD 将错误报告为验证错误。
或者,您也可以设计一个“预处理”XSLT 来识别和输出错误,而不是您正在寻找的输出,然后首先运行它。您可以通过从现有 XSLT 中删除所有输出并用
替换
来实现此目的。但老实说,这似乎有点“hacky”。或者最后一种可能性是简单地在输出中定义并输出
元素,并使用简单的 XPath 查询(>//错误
例如)。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.
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. You could probably doing that by removing any output from your existing XSLT, and substituting
<xsl:message>
with<xsl:text>
. To be honest though, that seems a bit of a 'hacky' way of doing it.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).