开发者

How to generate a failure at runtime in an xslt?

开发者 https://www.devze.com 2023-01-08 08:24 出处:网络
I need to generate a runtime error in an xslt.How to do so? The following xpaths do not generate runtime errors:

I need to generate a runtime error in an xslt. How to do so?

The following xpaths do not generate runtime errors:

  • "1 div 0"
  • "/*/*[1 div 0]"
  • "/*/*[0]"
  • "/*/*[NaN]"

It does not have to be done using xpath, could be done using some xslt construct.

The reason I want this is to effectively have a "NotImple开发者_运维知识库mentedException" in my xslt. There is a specific path that will not be used any time soon, so I do not want to implement it yet.


You can terminate an XSL script and deliver a message using the xsl:message element.

<xsl:message terminate="yes">
  NotImplementedException
</xsl:message>


In addidtion to <xsl:message> in XSLT 2.x one can use the standard XPath 2.0 function error().

0

精彩评论

暂无评论...
验证码 换一张
取 消