XsltMessageEncounteredEventArgs Class
Provides data for the XsltMessageEncountered event.
Assembly: System.Xml (in System.Xml.dll)
| Name | Description | |
|---|---|---|
![]() | XsltMessageEncounteredEventArgs() | Initializes a new instance of the XsltMessageEncounteredEventArgs class. |
| Name | Description | |
|---|---|---|
![]() | Message | Gets the contents of the xsl:message element. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Finalize() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | MemberwiseClone() | |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
The XsltMessageEncountered event occurs during XSLT processing when an xsl:message is specified in the style sheet.
Note |
|---|
If the terminate attribute is set to "yes", the XSLT processor stops executing the style sheet stops after the message is processed. |
The following example uses the XsltMessageEncounteredEventArgs to display xsl:message content to the console. The sample writes the following message to the console: Message received: Author name is not in the correct format <author><name>Plato</name></author>.
The example uses the following files as input:
books.xml
<bookstore> <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0"> <title>The Autobiography of Benjamin Franklin</title> <author> <first-name>Benjamin</first-name> <last-name>Franklin</last-name> </author> <price>8.99</price> </book> <book genre="novel" publicationdate="1967" ISBN="0-201-63361-2"> <title>The Confidence Man</title> <author> <first-name>Herman</first-name> <last-name>Melville</last-name> </author> <price>11.99</price> </book> <book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6"> <title>The Gorgias</title> <author> <name>Plato</name> </author> <price>9.99</price> </book> </bookstore>
message.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:template match="/"> <xsl:apply-templates select="*"/> <xsl:copy-of select="."/> </xsl:template> <xsl:template match="*"> <xsl:apply-templates select="//author"/> </xsl:template> <xsl:template match="author"> <xsl:if test="not (last-name)"> <xsl:message terminate="no">Author name is not in the correct format <xsl:copy-of select="."/> </xsl:message> </xsl:if> </xsl:template> </xsl:stylesheet>
Available since 2.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.



