Jump to content

VBscript XML


dooberry

Recommended Posts

I'm trying to create a web page (duuh - as if you couldn't guess that!!) where I can use a single xml document as a temporary data store, while using various XSL sheets to navigate sections of the XML data.I've done a test on the first transform by linking it to the XML document directly :<?xml-stylesheet type="text/xsl" href="blah.xsl"?>In this case it works.When I try to do this dynamically in VBscript by using the code in the tutorial on XSL- EDIT XML, the transform works (I can see the layout) but it doesn't show the values from the XML data.Can anyone help?Dooberry

Link to comment
Share on other sites

OK,I guess no-one hass had chance to read this yet so I'll out in the VBScript I am using to do the transform and someone can tell me where it's going wrong.Here it is:set xmldoc=CreateObject("Microsoft.XMLDOM") xmldoc.async=true xmldoc.load("Currentquote.xml") set xsldoc=CreateObject("Microsoft.XMLDOM") xsldoc.async=true xsldoc.load("Step1.xsl") Document.Write(xmldoc.transformnode(xsldoc))This is set as a non-procedural script in the header block of an HTML page, so the script generates the page on opening. This means that a client should be able to work on the data locally, and the submission is just sending the details of the XML document to the server datastore.If I was using ASP I would have had to use the Server.Createobject Method, but as I am expecting to work locally (for the time being) I can use plain old CreateObject. Is this where I am going wrong (my brain is starting to frazzle)? :)

Link to comment
Share on other sites

All these posts and still no answers. I'll put this down to the fact that this shouldn't happen and it must be the way my company installs software.Never mind.Dooberry - The only person who will speak to me

Link to comment
Share on other sites

I use the following which works fine in java script:<html><body> <script type="text/javascript"> //Comment - To create an instance of Microsoft's XML parser with JavaScript, use the following code: var xmlDoc=new ActiveXObject("Microsoft.XMLDOM") xmlDoc.async="false" //Comment - Then load the XML Document: xmlDoc.load("cd_catalogue.xml") //Comment - Same as above but then loading XSL Style Sheet: var xslDoc=new ActiveXObject("Microsoft.XMLDOM") xslDoc.async="false" xslDoc.load("cd_catalogue.xsl") //Comment - Transform xmlDoc with xslDoc and Write the output: document.write(xmlDoc.transformNode(xslDoc)) </script></body></html>I know it sound crazy, but you might want to change your transformnode function for transformNode, then I think it may work.Regards. Mike

Link to comment
Share on other sites

This is also brilliant for another reason - part of what I am doing involves a user entering data to prepare a document in varous xml stores (one for each part of the document). The user will then get a preview of the document at the end which will be a group of transforms all shown as one page (document.write will allow me to do as many transforms per page as I want). Once they're happy with the preview, the data will be transmitted to a database in its component parts.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...