Ask a questionAsk a question
 

AnswerXSL transformation in PPC app

  • Thursday, January 03, 2008 4:53 AMHariAdu Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I need my PPC app to do xsl transformation. So I added reference to msxml.tlb from “C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib\MsXml.Tlb”. I’ve written the following code.

     

                try

                {

                    string path = System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;

                    path = path.Substring(0, path.LastIndexOf("\\"));

                    MSXML2.DOMDocumentClass doc = new  MSXML2.DOMDocumentClass();

                    doc.load(path +"\\first.xml");

                   

                    MSXML2.DOMDocumentClass xsl = new MSXML2.DOMDocumentClass();

                    xsl.load(path + "\\firstXSL.xslt");

                    if (!string.IsNullOrEmpty(doc.parseError.reason) || !string.IsNullOrEmpty(xsl.parseError.reason))

                        throw new FileNotFoundException();

                    string s = doc.transformNode(xsl);

                    MessageBox.Show("Successfully transformed the xml" + s);

                    webBrowser1.DocumentText = s;

                }

                catch (Exception ex)

                {

                    MessageBox.Show("Following exception occurred:" + ex.Message);

                }

     

    This code succeeds execution, but does not get the values from xml file to the output. <xsl:value-of> is not replace with corresponding value from xml file.

     

    I tried adding reference to msxml4.dll from C:\WINDOWS\system32\msxml4.dll and this results in “Class not Registered” Exception.

     

    So I set the properties “ComRegister” to “Register” and “Copy to output directory” to “Copy always”. This modification gives a build error as follows:

     

    Error 1     Deployment and/or registration failed with error: 0x8973190e. Error writing file '%CSIDL_PROGRAM_FILES%\XSLT_PPC_Sample\msxml4.dll'. Error 0x800700c1: %CSIDL_PROGRAM_FILES%\XSLT_PPC_Sample\msxml4.dll is not a valid Win32 application.

          Device Connectivity Component

     

    Is there any possibility to do xsl transform on the device. If so how. I do not have WM5 sdk installed currently(I learnt that it includes MSXML2?? ). Please suggest a solution...

     

Answers

  • Thursday, January 03, 2008 5:12 AMIlya TumanovMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Your first attempt was mostly correct. You can't use desktop DLLs on device so second one naturally fails.

    MSXML support is built in ROM on device, no installation needed. You should install WM 5.0 SDK, make TLB file from IDL from that SDK and then use that in your project. See this for sequence if operations.

     

  • Thursday, January 03, 2008 9:38 PMAlex Yakhnin MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    See also this.

     

    -Alex

All Replies

  • Thursday, January 03, 2008 5:12 AMIlya TumanovMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Your first attempt was mostly correct. You can't use desktop DLLs on device so second one naturally fails.

    MSXML support is built in ROM on device, no installation needed. You should install WM 5.0 SDK, make TLB file from IDL from that SDK and then use that in your project. See this for sequence if operations.

     

  • Thursday, January 03, 2008 9:38 PMAlex Yakhnin MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    See also this.

     

    -Alex