Altova Mailing List Archives


Re: Persisting modified data in an xls transformation

From: "Joe Fawcett" <joefawcett@-------.--->
To: NULL
Date: 7/16/2004 11:19:00 AM
"Glenn M" <glenn.mantle@b...> wrote in message
news:328a5de4.0407151620.31a236b5@p......
> I use the following standard code to output my tranfsormed xml file
>
> <HTML>
> <HEAD>
>   <TITLE>sample</TITLE>
>   <SCRIPT language = "javascript">
>      function init()
>      {
>         var srcTree = new ActiveXObject("Msxml.DOMDocument");
>         srcTree.async=false;
>         srcTree.load("PublishedApps.xml");
>
>         var xsltTree= new ActiveXObject("Msxml.DOMDocument");
>         xsltTree.async = false;
>         xsltTree.load("AppTablEditor.xslt");
>
>         resTree.innerHTML = srcTree.transformNode(xsltTree);
>      }
>   </SCRIPT>
> </HEAD>
>
> <BODY onload = "init()" >
>    <div id="resTree"></div>
>
> </BODY>
> </HTML>
>
>
>
>
> AppTableEditor.xsl contains editable controls that the user can use to
> modify the contents. How can i persist these changes to my xml file
> with may be a save button on this html page?
>
> regards
>
> glenn
Firstly there's no quick solution. You are going to have to process the form
using JavaScript and build up an xml document using the DOM or by building
an xml string. Secondly you are going to run into security problems if you
wish to save to a local drive. This may not be a problem if the app runs on
an intranet or the like though. An alternative woul be to build your xml
string and post in to a server side page that saves it on the server.
For example if your form (frmMain) has textboxes called txtForenames and
txtSurname then you have the following:

 var oDataDom = new ActiveXObject("Msxml.DOMDocument.3.0");

var sForenames = document.fmMain.txtForenames.value;
var sSurname = document.fmMain.txtSurname.value;
var sXml = "<data><name><forenames>" + sForenames + "</forenames><surname>"
+ sSurname + "</surname></data>";
oDatDom.loadXML(sXml);

If you can get hold of Wrox's book "XML Application Development with MS XML
4", I'm not sure if Apress or Wiley now publish this still after buying
Wrox's titles, this has lots of examples of this type of thing. A step up
the ladder would be to use a purpose built app such as InfoPath.

-- 

Joe


Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.