LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to apply XSL to an XML (with ActiveX) efficently?

Hi Everybody,

I searched on the internet how to filter my XML with my XSL file. All I found is from the MSDN in C++ code. I tried to translate the code elements into C
(with msxml4.dll), but somehow it doesn't work. Some parts are working, but for example I cant "attach" the  style sheet  to  the  template.

Here you can find the page that I used:
http://msdn2.microsoft.com/en-us/library/ms767644.aspx

Is there anybody used this?

Thanks a lot:

Roland
0 Kudos
Message 1 of 4
(3,152 Views)
Hello again,

I want to clarify a bit what I actually did. For me, the expession "I tried to translate the code elements into C" means:  I tried to find the methods in Labwindows/CVI
to reach the same result as in C++ on the MSDN homepage. Which is mostly the same when you filter an XML with an XSL in Java, Visual Basic etc. It is because
they use the same MsXML ActiveX.

So where is the problem?

Here is some part of the code:

//start codes

CAObjHandle XSLTemplate;
CAObjHandle StyleSheet;

(...)
//some codes, but those are all right, nothing error
(...)

CA_VariantSetObjHandle(&StyleShtVariant, StyleSheet, CAVT_DISPATCH);         //it sets the variable type of StyleSheet from CAObjHandle to VARIANT_OBJECTHANDLE

MSXML2_SetPropertyByRef(XSLTemplate, &errorInfo, MSXML2_IXSLTemplatestylesheet, CAVT_OBJHANDLE, StyleShtVariant);

(...)
//some other codes
(...)

// end codes


from this point I have the problem:

MSXML2_SetPropertyByRef method calls the CA_PropertySetByRefVEx method which drops the next error: The program caused a "General Protection" fault at 001B:77E69868.

Is there anybody, who is specialist in XSLT with AcitveX in Labwindows/CVI (7.1)?

Thank you,
Roland

0 Kudos
Message 2 of 4
(3,138 Views)
I am not an XSLT expert or anything, but the problem may be in the call:

MSXML2_SetPropertyByRef(XSLTemplate, &errorInfo, MSXML2_IXSLTemplatestylesheet, CAVT_OBJHANDLE, StyleShtVariant);

In this call, you are saying the property type is an object handle but you are passing a variant. I think you should just pass the style sheet object handle itself in the last parameter of this function.
0 Kudos
Message 3 of 4
(3,122 Views)
Hallo Mohan,
 
thank you for your answer again.
 
Well... as I can remember, I tried. The type CAVT_OBJHANDLE and CAObjHandle are different. Aren't they? So that's why I casted the original Stylesheet CAObjHandler to CAVT_OBJHANDLE.
I am not at my computer at work, but I will try and let you know.
 
Have a nice weekend.  Smiley Wink
 
Roland
 
0 Kudos
Message 4 of 4
(3,118 Views)