Create XSL
Posted on June 28, 2011
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 'XSL Handling - Create XSL Public Function createXSL(XslFile As String) 'This code is used to create XSL. Dim fso As New Scripting.FileSystemObject Dim objXSL As Object Dim strTemp As String, strXSL As String strXSL = XslFile fso.CreateTextFile strXSL, False Set objXSL = fso.OpenTextFile(strXSL, ForAppending) strTemp = "<?xml version=""1.0""?>" _ & vbCrLf & "<xsl:stylesheet version=""1.0"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"">" _ & vbCrLf & "<xsl:template match=""/"">" _ & vbCrLf & "<html>" _ & vbCrLf & "<Body>" _ & vbCrLf & "<Table Border=""1"" bordercolor= ""#808080"" cellspacing=""0"" cellpadding=""0"" width=""100%"">" _ & vbCrLf & "<tr style=""background:#999999;font-size:8.0pt; font-family:Tahoma;color:white"" align=""center"">" _ & vbCrLf & "<td width=""13%""><b>Date & Time</b></td>" _ & vbCrLf & "<td width=""10%""><b>User Name</b></td>" _ & vbCrLf & "<td width=""11%""><b>Machine Name</b></td>" _ & vbCrLf & "<td width=""12%""><b>File Name</b></td>" _ & vbCrLf & "<td width=""13%""><b>Procedure Name</b></td>" _ & vbCrLf & "<td width=""6%""><b>Error No</b></td>" _ & vbCrLf & "<td width=""35%""><b>Error Description</b></td></tr>" _ & vbCrLf & "<xsl:for-each select=""ErrorLog/Error"">" strTemp = strTemp & "<xsl:if test=""ErrorDateTime !="""""">" _ & vbCrLf & "<tr style=""font-size:8.0pt;font-family:Tahoma; color:black"" align=""center"">" _ & vbCrLf & "<td width=""13%""><xsl:value-of select=""ErrorDateTime""/></td>" _ & vbCrLf & "<td width=""10%""><xsl:value-of select=""UserName""/></td>" _ & vbCrLf & "<td width=""11%""><xsl:value-of select=""MachineName""/></td>" _ & vbCrLf & "<td width=""12%""><xsl:value-of select=""DocName""/></td>" _ & vbCrLf & "<td width=""13%""><xsl:value-of select=""ProcName""/></td>" _ & vbCrLf & "<td width=""6%""><xsl:value-of select=""ErrNo""/></td>" _ & vbCrLf & "<td width=""35%""><xsl:value-of select=""ErrDesc""/></td></tr>" _ & vbCrLf & "</xsl:if>" _ & vbCrLf & "</xsl:for-each>" _ & vbCrLf & "</Table>" _ & vbCrLf & "</Body>" _ & vbCrLf & "</html>" _ & vbCrLf & "</xsl:template>" _ & vbCrLf & "</xsl:stylesheet>" objXSL.WriteLine strTemp objXSL.Close ExitHere: Err.Clear Set objXSL = Nothing Set fso = Nothing End Function |