How to create an exception error when processing conversion between xml and xslt

I have a doubt when we execute some process in C # .net during the transition, if some kind of error can occur at that time, we linger in the error log

similarly, when it is assumed that we are executing a process between xml and xslt during error handling, the question may arise about how we can catch these exceptions!

Anyone has an idea ... because he will use to check for me so kindly let me know about any possibilities for this.

+6
source share
2 answers

You can use xsl:message .

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

NOTE An XSLT processor can implement an xsl message: by popping up a warning window or by writing to a log file.

If the terminate attribute is yes, then the XSLT processor should stop processing after sending the message. By default, the value is not equal.

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

Use xsl: message :

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

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

0
source

Source: https://habr.com/ru/post/895469/


All Articles