Jump to content

A very weird problem in server-side transformation


suki

Recommended Posts

Hi all, I am experiencing a weird problem that I simply cannot figure out:I am using a server-side transformation xml/xslt with the following vbScript code:

'create the xml parser for a later useFunction CreateParser()	Dim objTemp	set objTemp=Server.CreateObject("Msxml2.DOMDocument.4.0")	objTemp.async=false		objTemp.resolveExternals=false  'do not resolve externals definitions such schema	objTemp.validateOnParse = false 'do not parsing ,since there is no schema to validate	set CreateParser=objTemp	End Function'main code and transformationdim xmlDoc set xmlDoc =  CreateParser()xmlDoc.loadXML("<xml/>")	'-----XSL---------------------------------------dim xslDoc, loadSuccess set xslDoc =  CreateParser()loadSuccess = xslDoc.load(Server.MapPath( "myXslFile.xsl"))If loadSuccess <> true then  response.write "Error while parsing XSL"end if'-----XML---------------------------------------dim xmlDocStrxmlDocStr = xmlDoc.xmlxmlDocStr = "<?lang " & lang & "?>" & xmlDocStrloadSuccess = xmlDoc.loadXML(xmlDocStr)If loadSuccess <> true then  response.write "Error while parsing XML"End If-----The transformation---------------------------------------xmlDoc.transformNodeToObject xslDoc,response

My problem is this:When I use DOMDocument.4.0 everything works just fine!But when I use DOMDocument.3.0, if I have any

<xsl:include href="anotherXslFile.xsl" />

it is being totaly ignored by my xsl file.I can not use any templates or variables on external xsl files.Unfortunately, the server on which my site is supposed to "sit", only supports DOMDocument.3.0Has anyone seen that? I have tried to read every posible information regarding the differences between the two versions, but I cannot figure what is the couse to this strange behaviour...Thanks in advanced!!Suki

Link to comment
Share on other sites

The path which MSXML3.0 gets may be wrong. Try to use an absolute path to the included XSLT file, i.e. one that begins similarly to "file:///C|/".

Link to comment
Share on other sites

Tried it... It still won't work.also, xsl:import won't work the same way.The strange thing is, I don't get any error messges regarding that included file. It just being totaly ignored by the code as if the xsl:include line jjust isn't there.

Link to comment
Share on other sites

Tried it... It still won't work.also, xsl:import won't work the same way.The strange thing is, I don't get any error messges regarding that included file. It just being totaly ignored by the code as if the xsl:include line jjust isn't there.
That's normal. If there's any way you get get the error log of the transformation, you'll see the failure as a warning only (logical, since the XSLT processor would stop at any critical error).Is it possible that the version of MSXML 3.0 is just too early? I mean, earlier versions had a different implementation of XSLT, which is not compatible with later ones... unlikely, yes, but it's still possible. Why can't you just change the server and/or ask the host to upgrade and be over with it?
Link to comment
Share on other sites

umm... I find it hard to believe it's a version too early. After all, this is one of those things that gets updated with any windows update, isn't it?As for the host server... well I tried talking to them. It's a win2003 server with all service packs and all latest updates. But for some reason, the version 4.0 isn't working there.They can't do any major updates because they fear that updating the version 4 will hurt any of the other existing versions. Too many working websites are using the same server so they can't do it.

Link to comment
Share on other sites

umm... I find it hard to believe it's a version too early. After all, this is one of those things that gets updated with any windows update, isn't it?As for the host server... well I tried talking to them. It's a win2003 server with all service packs and all latest updates. But for some reason, the version 4.0 isn't working there.They can't do any major updates because they fear that updating the version 4 will hurt any of the other existing versions. Too many working websites are using the same server so they can't do it.
They're WRONG! You can tell them THAT! Multiple versions can work independantly, and can be switched with the constructor. If they have all updates, including the optional ones, they must have MSXML 6, which is actually the latest MSXML version, and it's far better than MSXML 3 or MSXML 4. Try to use that one instead. And if they don't have them, tell them to get it, and have no fear. If they don't listen to you even then, ask on MSDN's forums if I'm right about this one. Hopefully some MVP will answer you that I am, and if they don't listen to you even then, get a new host.
Link to comment
Share on other sites

:-) First - Thank you very much for your help!As for the host... I am not very happy about them either, but unfortunately it is not my decision wether to stay or leave...Besides, since I know they do update their servers regulary, I suspect that there is a bigger technical problem there which prevents from versions 4 and later to work properly.As for the code... ghost in the machine... I spent the entire night last nght, writing all my server side function again (without peeking at any of the old ones :) ) and now it all works fine.I must say I have no idea what was the diference between the two. perhaps I am just too tired to see, but anywy... at least it works - and on time!I wish I knew what was that stupid thing :-(Thanks again!!Suki

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...