Re: MSXML2.XSLTransform on WM5 exists? Or is there another way?!?
- From: "John Spaith [MS]" <jspaith@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 16 Oct 2007 14:16:40 -0700
Sky - first, for someone who claims not to know C++/COM, you get around
pretty well!
Unfortunately XSLTransform stuff isn't supported on CE.
http://msdn2.microsoft.com/en-us/library/aa926556.aspx. Agree it's
misleading that it's still in the header file.
To answer your question in the context of doing what you want to have work
without XSLTransform -- I don't know! Even though I'm the MSXML dev on CE,
most of my work was componentized it for RAM/ROM (obnoxious things like
removing XSLTransform :() and various low level platform stuff, so the
transform stuff I haven't dealt with.
If no one on the newsgroup can help out, actually what I'd do is go to one
of the "real" MSXML discussin groups and explain your problem and the
constraints of the platform. Some folks on newsgroup know this stuff well,
but we're more general system/apps dev folks.
Sorry for issues you're hitting and good luck on getting this fixed.
--
John Spaith
Senior Software Design Engineer
Windows CE Networking
Microsoft Corporation
http://blogs.msdn.com/cenet/.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2007 Microsoft Corporation. All rights
reserved.
"Sky" <public.skysigal{*AT*}xact-solutions.com> wrote in message
news:C554C53C-A9CB-4A09-A9E1-CDB4F17E02EF@xxxxxxxxxxxxxxxx
Hello:
I've been looking all over the place for a way to transform XML via XSL on
a
PocketPC, using Params.
And although have had some success (described below), still am missing one
or two crucial parts...namely, parameters.
Any help would be greatly appreciated!
Setup:
I found a brief hint on the net that indicated that NET 2.0 CF did not
have
XSL methods built in, but that they could be done via ActiveX as follows:
a) install C++ tools from VS2005
b) in order to have MIDL.EXE installed,
c) then run it as follows:
C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC
SDK\Include\Armv4i>midl msxml2.idl /I "C:\Program Files\Microsoft Visual
Studio 8\VC\PlatformSDK\Include"
to get a MSXML20.tlb
d) which i then included in a C# program.
That done, I tried the following, which works:
The following then works to transform the XML with XSL:
string TransformNoArgs(string xmlFilePath, string xslFilePath){
MSXML2.DOMDocument xml = new MSXML2.DOMDocumentClass();
xml.load(xmlFilePath);
MSXML2.DOMDocument xsl = new MSXML2.DOMDocumentClass();
xsl.load(xslFilePath);
// Transform XML data.
return xml.transformNode(xsl);
}
This works fine. Its not cached, so it is a heavy solution...but it works
as
promised.
The remaining, but crucial, problem is to find a way to inject arguments
into an xsl that is used on PC and PPC, that includes params such as the
following:
<xsl:param name="cssDirPath"/>
<xsl:param name="imgDirPath"/>
<xsl:param name="dataSourceName"/>
I then tried the following method:
string TransformWithArgs(string xmlFilePath, string xslFilePath){
MSXML2.DOMDocument xml = new MSXML2.DOMDocumentClass();
xml.load(xmlFilePath);
MSXML2.DOMDocument xsl = new MSXML2.DOMDocumentClass();
xsl.load(xslFilePath);
MSXML2.XSLTemplate template = new MSXML2.XSLTemplate();
template.stylesheet = xsl;
MSXML2.IXSLProcessor processor;
processor = template.createProcessor();
processor.addParameter("rootDir", C_ROOT_DIR, string.Empty);
processor.addParameter("cssDirPath", C_CSS_DIR, string.Empty);
processor.addParameter("imgDirPath", C_IMG_DIR, string.Empty);
processor.input = xml;
processor.transform();
return (string)processor.output;
}
But it fails on XSLTemplate saying it cannot create XSLTemplate.
I am assuming that this is because there is a stub there in the *.h file,
but the code was not ported to CE (I'm probably wrong -- I know almost
nothing about C, C++, and COM really)
So my question is simply
a) Is there a way to inject Param values without using XSLTransform so
that
the XSLT can be used as is...
b) What other way could I create a parametricizeable transformations, in a
format that will work both on CE and PC (it would be a nightmare to have
to
rewrite a lot of files that I already have, and would prefer to find a
code
solution/change rather than a XSL change if it can be done...)
Many many thanks!
Sky
.
- Follow-Ups:
- References:
- Prev by Date: Re: Process Kills Itself
- Next by Date: Re: MSXML2.XSLTransform on WM5 exists? Or is there another way?!?
- Previous by thread: MSXML2.XSLTransform on WM5 exists? Or is there another way?!?
- Next by thread: Re: MSXML2.XSLTransform on WM5 exists? Or is there another way?!?
- Index(es):
Relevant Pages
|