|
Haha, I know, answer it yourself
Public Function Test(ByVal Expression As String) As Single
On Error GoTo ErrorHandle
Dim domSource As New DOMDocument
Dim domStyleSheet As New DOMDocument
Dim domResult As New DOMDocument
Dim str As String
str = "<?xml version='1.0' encoding='GB2312'?>" + vbCrLf
str = str + "<xml>"
str = str + "<expression>"
str = str + Expression
str = str + "</expression>"
str = str + "</xml>"
domSource.loadXML str
str = "<?xml version='1.0' encoding='gb2312'?>" + vbCrLf
str = str + "<xsl:stylesheet xmlns:xsl='http://www.w3.org/TR/WD-xsl'>"
str = str + "<xsl:template match='/'>"
str = str + "<Result>"
str = str + "<xsl:eval language='vbscript'>Eval(me.text)</xsl:eval>"
str = str + "</Result>"
str = str + "</xsl:template>"
str = str + "</xsl:stylesheet>"
domStyleSheet.loadXML str
domSource.transformNodeToObject domStyleSheet, domResult
Test = domResult.Text
'Test = True
Exit Function
ErrorHandle:
Test = False
End Function |
|