<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="errorlog.xslt"?> <ErrorLog> <ErrorDetail> <Time>10/9/2003 12:47:37 PM</Time> <Message>Unable to perform search</Message> <Type>System.Exception</Type> <Site>Void btnSearch_Click(System.Object, System.EventArgs)</Site> <Trace>Stack trace info replaced for sake of brevity</Trace> </ErrorDetail> <ErrorDetail> <Time>10/9/2003 12:48:38 PM</Time> <Message>SQL Server does not exist or access denied</Message> <Type>System.Exception</Type> <Site>Void btnSearch_Click(System.Object, System.EventArgs)</Site> <Trace>Much more Stack trace info replaced for the sake of brevity</Trace> </ErrorDetail> </ErrorLog>With this XSLT:
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/ErrorDetail"> <head> <title>Amex Commercial Error Log</title> </head> <body> <TABLE id="Table1" height="588" cellSpacing="1" cellPadding="1" width="971" border="1"> <TR> <TD width="249" bgColor="#003399" height="27"> <P><FONT face="Tahoma" color="#ffffff"><STRONG>Time</STRONG></FONT></P> </TD> <TD width="213" bgColor="#003399" height="27"> <P><FONT face="Tahoma" color="#ffffff"><STRONG>Message</STRONG></FONT></P> </TD> <TD width="142" bgColor="#003399" height="27"> <P><FONT face="Tahoma" color="#ffffff"><STRONG>Error Type</STRONG></FONT></P> </TD> <TD width="259" bgColor="#003399" height="27"> <P><FONT face="Tahoma" color="#ffffff"><STRONG>Module</STRONG></FONT></P> </TD> <TD bgColor="#003399" height="27"> <P><FONT face="Tahoma" color="#ffffff"><STRONG>Call Stack</STRONG></FONT></P> </TD> </TR> <TR> <TD width="249" height="103"><xsl:value-of select="Time"/></TD> <TD width="213" height="103"><xsl:value-of select="Message"/></TD> <TD width="142" height="103"><xsl:value-of select="Type"/></TD> <TD width="259" height="103"><xsl:value-of select="Site"/></TD> <TD height="103"><xsl:value-of select="Trace"/></TD> </TR> </TABLE> </body> </xsl:template> </xsl:stylesheet>Gives this result:
10/9/2003 12:47:37 PMUnable to perform searchSystem.ExceptionVoid btnSearch_Click(System.Object, System.EventArgs)Stack trace info replaced for sake of brevity10/9/2003 12:48:38 PMSQL Server does not exist or access deniedSystem.ExceptionVoid btnSearch_Click(System.Object, System.EventArgs) Much more Stack trace info replaced for the sake of brevityObviously, this isn't what I'm after (not surprising as this is my first attempt at writing an XSLT file <g>).