开发者

how to produce exception error while transformation processing between xml and xslt

i am having a doubt when we are doing any process in c#.net on going if some thing error would may come at that time we are trapping in error log

similarly when suppose we are doing any process between xml and xslt on processing error would may come at that how we can trap that exceptions!

can any one have an idea... beca开发者_如何学JAVAuse it will use for validations for me so , kindly let me know any possibilities for that.


You can use xsl:message.

The xsl:message instruction sends a message in a way that is dependent on the XSLT processor. The content of the xsl:message instruction is a template. The xsl:message is instantiated by instantiating the content to create an XML fragment. This XML fragment is the content of the message.

NOTE:An XSLT processor might implement xsl:message by popping up an alert box or by writing to a log file.

If the terminate attribute has the value yes, then the XSLT processor should terminate processing after sending the message. The default value is no.

<xsl:message
  terminate = "yes">
  <!-- Content: message describing the error -->
</xsl:message>


Use xsl:message:

<xsl:message terminate="yes">Your Message here.</xsl:message>

This causes the XslCompiledTransform.Transform() method to throw an XsltException which you can catch in the usual C# try/catch way.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜