Jump to content

dooberry

Members
  • Posts

    133
  • Joined

  • Last visited

Everything posted by dooberry

  1. :)Ok,This is one of the most frustrating things I've ever come across in my brief and amateur history of programming.I have to use the document of an HTA file to save xml documents it's a security setting and I can't change it.What I am trying to do (now using a table because frames don't have the same privileges as the hta file which contains them) is use a table to replicate the behaviour of frames.I know that it's possible to put script into a table cell in the original page content.I cannot for love nor money change a table cell's content to contain script once once the page has been loaded. The innerHTML property changes fine, but excludes any script content.The outerHTML property cannot be changed at runtime (I think because it overwrites the HTML which defines the table cell in the first place and this causes problems with the table).How on this strange blue planet full of wonderful and mysterious creatures do I change the table cell so that it includes script that wasn't there before?here is the code:<html><script language="javascript">function loadpage(param1, param2){ var xmldoc var xsldoc var wpage xmldoc = new ActiveXObject("Microsoft.XMLDOM") xsldoc = new ActiveXObject("Microsoft.XMLDOM") xmldoc.load(param1) xsldoc.load(param2) wpage = xmldoc.transformNode(xsldoc) document.getElementById("formdisplay").innerHTML=wpage}</script><body><table height="100%" width="100%" id="navsystem"><tr ><td width="20%"><html><input type="button" name="showcontact" value="Edit Contact Details" onclick="loadpage('quote.xml','contact.xsl')" /></td><td bgcolor="aaddff" width="80%" rowspan="5" align="center" id="formdisplay"></td></tr><tr><td width="20%">item1</td></tr><tr><td width="20%">item1</td></tr><tr><td width="20%">item1</td></tr><tr><td width="20%">item1</td></tr></table></body></html> If anyone can help I would really appreciate it.
  2. dooberry

    xml dom question

    this is actually covered in the tutorial, but there is a snag if you're using it on a client rather than a server.In your code all you need to do is add :xmldoc.save("<enter the path and filename here>") Dooberry
  3. :DThat looks like it'll work.Thanks.
  4. Ok,I have an idea based on my previous one.Instead of using the frames that I had before that caused the error with write privileges I would like to use a table layout to make sure that the script is contained in the main page and is being used by the "hta" file, not a link to another page.Does anyone know of a way to create a table with several rows in the first column and only one row in the second which will span the height of the table?Alternatively, will I encounter problems with a table if I have a different number of items in each row e.g. <table><tr width = "100%" height = "100%"><td width="20%"> item1</td><td width="20%"> item2</td><td width="20%"> item3</td><td width="20%"> item4</td><td width="20%"> item5</td></tr><tr><td width = "100%"> item6</td></tr></table> Or is there an even better way to do this without using tables or framesets?If anyone can help I'd appreciate it - A LOT!!!!:)Dooberry
  5. If you want to keep it really basic, try using vbscript in the page to add to a ".csv" file (basic file input output using read and write commands).You could then get the employee to login and store their name in a variable that gets written to the file as their data is submitted.csv files open in excel and your client could even look at reporting this data with a pivottable (Excel equivalent of OLAP) assuming that the useful data is numeric. This would be a much smaller scale solution than using MySQL though and I wouldn't recommend it if there is going to be a large amount of data (say more than 50MB) or if there needs to be a lot of security on the information, but in terms of understanding simple data exchange it's a good place to start.Dooberry
  6. Ok, I've had a re-think about this and although it works, the problem is that the code which writes to the xml file is not direct content of the hta page - this means that frames are not viable.Is there a way of emulating frames with a table (probably not considered good technique)?What I am considering is that I have a table with the navigation items at the top and the form underneath (I assume that there will be some way of using thead and tbody to do this?).Has anyone used this before and is there a clever way of doing it?The essence of it will be whether or a <td> element has a document property.If anyone can answer this can you please help?Thanks folks.Dooberry
  7. For anyone reading this topic, please check out the following:There's a hole in my bucket!!
  8. Right,I got the script to work by replacing the code with the following: window.frameElement.parentElement.document.frames['frm'].document.write(loadpage('<xmldocument>','<xslsheet>')) this is quite funny, does anyone know the song "there's a hole in my bucket"?What's happened is I created a .hta file to do the transform so that I would gain access to save the output document when I first created the form - sorted.Then I had the palava with putting external document references in to create select controls - sorted.Then I wanted a menu of links to navigate the different portions of the document and make entry easier - sorted.Now I'm back at step 1 and I've lost the permission to use the XMLDOC.save method again even though I have an hta file running and executing the code.Does anyone know a way to override the local permissions of the page to allow saving of an xml document?
  9. It's most peculiar, but I think it's because I'm setting the innerHTML property.What happens is the form displays where it should and as it should, but there is script which should run in the form.When the event happens that should trigger the script, the page generates an error which says "submitrecord not defined" (submitrecord is the name of the procedure that stores the record).I think I have to use the write() method of the document object to get this to work, I'll let you know if this fixes it .Dooberry
  10. Ok, this works fine for loading in the form but now the script that is in the xsl file doesn't work .How do I get round that? Dooberry
  11. I am a cunning devil!!!! I used the object browser to find another way down to the frames collection that worked and here it is:window.frameElement.parentElement.document.frames['frm'].document.body.innerHTML=LoadPage('quote.xml','contact.xsl') It's ugly but it works!!And here is the code for LoadPage: function LoadPage(xmlpage, xslpage) { var xmldoc, xsldoc, page xmldoc=new ActiveXObject("Microsoft.XMLDOM"); xmldoc.async="false"; xmldoc.load(xmlpage); xsldoc=new ActiveXObject("Microsoft.XMLDOM"); xsldoc.async="false"; xsldoc.load(xslpage); page = xmldoc.transformNode(xsldoc) return page} Thanks for all your help and inspiration - this is a major breakthrough in my project and I can do everything I need from here.Dooberry .
  12. As far as I can tell the XSL is ok.I've linked the xml sheet to it directly and the form appears and behaves exactly as I would expect.I've also used a page with script to execute the transform using XMLDOM and it still appears ok.I've used the script debugger that ships with MS Office to look at the frame script and I've put in the code one step at a time.If I create a watch on the code doing the transform then I can see the html as a string.I can also see the innerhtml attribute of the current frame as a string via the documentelement property.If create a watch on 'window.parent.frames("frm")' then this always creates the exception - frm is the name of the frame where I want the output to appear.Up until that point it allows me to navigate the object.I think that there is one of two problems occuring - either the frames collection does not support reference to a member of the collection by name or I am not referencing the frame correctly.Either way I'll let you know if the Java fixes it.
  13. I'll try it in java (I'm sure if I plug away it'll work). It's as if VB doesn't reference the frames collection properly so it can't identify items within it, there's naff all help on the MSDN website about it so stuff MS.At least I don't have to use C++ to do it, now that would be difficult (or not depending on whether or not I write my own XML model - talk about reinventing the wheel)!!Thanks for your help and I'll try it your way this time.Dooberry.
  14. Scott,Thanks for the info. I've tried this and it's raising the same error that I was getting before - 'Exception Occured' . I've tried tweaking the code to the following (bearing in mind I'm using vbscript not java): window.parent.frames("frm").document.write xmldoc.transformnode(xsldoc) and I'm still getting the same problem .The only thing I can think is that the reference to the frame is not working or the transformnode function is not returning correct html?If you or anyone else can see anything wrong with my code then please reply asap. Any help is always welcome .Dooberry
  15. Can someone help me please?I'm doing stuff in xsl/xml - but that's not really important.If I have a text variable which contains a string of html, how can I use script to make a frame show the output of the text variable?I have a web page with 2 frames, one for navigation and one for display.When the user clicks a button/image on the left I want my script to build the html to display on the right.I appreciate that this is an unorthodox way of using frames, but it is important that it works this way.Any help would be appreciated .Dooberry.
  16. dooberry

    DATA BINDING

    Hi there I saw this and thought of you . I think your biggest problem here is that all of the values are attributes and not elements.If you look at the XSL tutorial, it will show you how to deal with extracting attributes by using @ combined with <xsl:value-of>.If you only needed to select individual pieces of information then use the following as a base code and edit it how you see fit (if it doesn't work then I apologise because I'm quite new to this myself): <?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates select="address"/><xsl:template match="address">address: <xsl:value-of select="@addr" /><br />address type: <xsl:value-of select="@addrtype" /></xsl:template></xsl:stylesheet> If you save the above as an xsl file then you can link the two by using script that you can find in the XMLDOM tutorial in the W3Schools website.Hope this helps.Dooberry.
  17. Ok,here's another topic for fun.I need to create a document with two frames in it, one for navigation and one for the target.When I click on the link I want the target frame to contain the output of a dynamic transform.The script I am using for the transform is as follows and is in the frame with the links: Sub loadpage (xmlfile, xslfile)Set xmldoc = CreateObject("Microsoft.XMLDOM")Set xsldoc = CreateObject("Microsoft.XMLDOM")xmldoc.load xmlfilexsldoc.load xslfileset wpage = xmldoc.transformnode(xsldoc) Ok,How do I get wpage to appear in the target frame using the script?I've tried using the parent object and I keep getting errorsIf anyone can help I'd appreciate it. Dooberry.
  18. What does your xml structure look like?
  19. I think I'd have to disagree with the remark that you can't use xml with forms. I'm using it ok at the moment and I'm writing a "server free" application which will allow people to work offline and work online when they have network availability. Every time I've encountered a problem, I've found a way to work round it on here.The other thing that's great about xml is you can remove the need for relational data management by using the parent/child relationship of elements and nodes, or you can use multiple documents in a relational manner if you want to think in database terms.Quite frankly, XML ROCKS as a language and I think that databases will become a thing of the past as technology improves and XML awareness increases .
  20. I did something similar to this in a relational database once.Applying xml to it, you could have a relational list of menu items and users which you could administer with an xsl form.For the menu: <menu> <item id="homepage"> <text>Home page</text> <link>"http://someotherwebpage.htm"</link> </item> ..</menu> For the users: <users> <user> <name>A User Name</name> <password>Cillitbangpassword</password> <loginname>user login</loginname> </user></users> Then have another xml document which is like this: <usermenuitem> <item>selectedmenuitem</item> <userid>selecteduser</userid> <privelege>useraccesslevel</privelege></usermenuitem> You can then link the values through xsl on the other documents containing the users and menu items: <xsl:template match="usermenuitem"><select id="menuitem"> <xsl:for-each select="document('menuitems.xml')//menu/item"> <option> <xsl:attribute name="value"> <xsl:value-of select="link" /> </xsl:attribute > <xsl:value-of select="text"> </option> </xsl:for-each></select><select id="linktouser"> <xsl:for-each select="document('users.xml')//users/user"> <option> <xsl:attribute name="value"> <xsl:value-of select="loginname" /> </xsl:attribute > <xsl:value-of select="name"> </option> </xsl:for-each></select></xsl:template> This would then link the user and menu items into a single file and allow you to add or remove priveleges (with some code) by using drop downs looking at the menu items and the user lists.Then you can use an xsl:for-each element to load the link information from the menu document into the web page.Using the "document()" xpath function allows you to gather information from other documents on the server and isolate each bit of information you want to store.I hope this helps, if it doesn't I apologise .Dooberry
  21. Thanks for the advice. So what you're saying is I would either need to write lots of script or download some kind of data mapping software to audit the data against the schema?Ok, here's a thought for the W3C, what about adding a data connection element to the Schema template?This would allow a developer to use the schema for validation of data and then submit the data to a database via the data connection element and reject invalid entries of data from the server.I'm sure that given the spare time, I could write enough script to do this in my xsl sheets, but I am writing a client based system rather than a server based one because it needs to be used offline and my resources are very limited (notepad!!).If anyone wants to help with this I would appreciate it a lot and I would be very interested in hearing peoples' thoughts. Thanks in advance for your interest.Dooberry.
  22. Guys,I've put this post in the Schema forum (although it seems like a bit of a dead man's land at the moment).Help Me! I'm stuck in a mineshaft Can someone help by replying here or to the post in the forum please?Thanks,Dooberry
  23. I have read the XSD tutorial and I know how to create the different types of elements.How the ###### do I use this to interact with a database?I know that the Schema will validate the data and that's what I want (rather than having spurious rubbish all over the place), but are there elements I can use to connect to a database and submit data?I was planning to use ADO in an XSL file, but that's a lot of time and effort to do the same job that I believe an XSD file will be able to do.If anyone can help I will be eternally grateful - I'll be even more grateful if you could reply next week (where's the begging bowl smilie? you really should have one!! ).Thanks in advance,Dooberry.
  24. I fixed it:I had to get rid of the braces {} around the variable in the filter condition.I also made an explicit reference to the document containing the value I needed to filter on so it ended up something like this: <xsl:variable name="var1" select="Document('userdata.xml')//root/element" /><select id="dropdownbox"> <xsl:for-each select="Document('listoptions.xml')//root/optionelement[filterelement=$var1]"> <option> <xsl:attribute name="value"> <xsl:value-of select="optionvalueelement" /> </xsl:attribute> <xsl:value-of select="descriptionelement" /> </option> </xsl:for-each></select> This allowed me to use one file as a set of options for a select control and another file to control which of the options appeared, based on what the user had already entered. I'm nearly ready to start scripting this to write back to a database now so thanks to everyone who has helped with these posts. I hope any code I've submitted has been useful - feel free to give me any feedback.As we say in the West Midlands "Taraah a bit bab!!"Dooberry.
  25. I'm a bit bemused (see above!!).I'm trying to restrict a <for-each> element based on the value a user enters in a particular node.I've tried the following:<xsl:template match="selectfilter" ><xsl:variable name="var1" select="elementpath" /><select name="filteredselect" ><xsl:for-each select="filterselection[filterelement={$var1}]"><option><xsl:value-of select="element" /></option></xsl:for-each></select></xsl:template> I keep getting an error because of the variable reference, if someone could tell me where I'm being a little bit *naff* I'd appreciate it.Dooberry scented eau de toilette.
×
×
  • Create New...