Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Transforming an XML using XSL(with VB Script) using MSXML4.0

From: Jnani@-----------.---------.---
To: NULL
Date: 9/5/2006 5:57:00 AM

I have an XSL which has a VB script function embedded. I need to tranform an 
XML using MSXML4.0. I am getting "Invalid class string" error. XML, XSL and 
the code is given below. 

XSL->

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:var="urn:var" 
xmlns:user="urn:user" exclude-result-prefixes="msxsl var user xsi">
	<xsl:template match="/Root/Parent">
		<Result>
			<xsl:value-of select="//Data"/>
		</Result>
	</xsl:template>
	<msxsl:script language="VB" implements-prefix="user"><![CDATA[	
	    Function DateToday() As String
			Return Date.Now.ToShortDateString
	    End Function
    ]]></msxsl:script>
</xsl:stylesheet>

XML->
<Root>
	<Parent>
		<Data>DataToBeRetrieved</Data>
	</Parent>
</Root>

C#.Net method being used

		public static string Ex_Transform(XmlDocument oXML, XmlDocument oXSL)
		{
			String sRet = null; 
			try
			{
				MSXML2.DOMDocument40Class oCOMXml = new MSXML2.DOMDocument40Class();
				MSXML2.DOMDocument40Class oCOMXsl = new MSXML2.DOMDocument40Class();
				oCOMXml.load("<XMLPath>");
				oCOMXsl.load("<XSLPath>");
				sRet = oCOMXml.transformNode(oCOMXsl).ToString();
			}
			catch (Exception exception2)
			{
				throw exception2;
			}
			return sRet;
		}
Please help.


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent