Subject: RE: Write to XML file using XSL From: "Chris Bayes" <Chris@xxxxxxxxxxx> Date: Thu, 17 Aug 2000 21:25:39 +0100 |
Jaimin, This is the second time you have asked a question like this today and the answer is there is no simple answer. There are no simple readymade solutions and no functions in JavaScript that will do it. There are however many different ways to solve this problem. One solution I'll outline here. Using this xml <form> <input>xxx</input> <input>yyy</input> <input>zzz</input> </form> In your XSL transform write a template for the <input> tag that outputs your html <INPUT> box. Give the <INPUT> box an attribute xpath that contains a unique path to the xml that generated it. Something like <xsl:template match="input"> <INPUT onchange="updateXML(this)"> <xsl:attribute name="value"><xsl:value-of select="text() /></xsl:attribute> <xsl:attribute name="xpath"><xsl:call-template name="getXpath" /></xsl:attribute> </INPUT> </xsl:template> <xsl:template name="getXpath"> <!-- can't remember this off the top of my head but it is in the xsl faq --> </xsl:template> You then need a JavaScript function that will update the xml when the input box changes. Something like this will do. function updateXML(obj){ var x = document.XMLDocument; var n = x.selectSingleNode(obj.xpath); n.nodeValue = obj.value; } Then you need to save the xml to a file. There are many ways to do this too depending on where you want the file to end up. Check out document.XMLDocument.save("filename") and XMLHTTP.open()/send() Ciao Chris XML/XSL Portal http://www.bayes.co.uk/xml >-----Original Message----- >From: owner-xsl-list@xxxxxxxxxxxxxxxx >[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of >JaiminSoni123@xxxxxxx >Sent: 17 August 2000 20:36 >To: xsl-list@xxxxxxxxxxxxxxxx >Subject: Write to XML file using XSL > > >Hi Guys, > Does anyone know how to write to an xml file using the XSL >stylesheet that it calls?? In other words, I have and xsl which >produces textboxes in several places in the xml document. The >value a user enters in to these text boxes has to go in the xml >file and add to or update the file. Does any one know how i could >do this. Is there a javascript function or something that I could >use to get this functionality?? Please let me know soon. any >help would be greatly appreciated. Thanks. > >Jaimin. > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Write to XML file using XSL, JaiminSoni123 | Thread | Formatting text within an element, Raheja, Dhruv (TRAN |
Write to XML file using XSL, JaiminSoni123 | Date | RE: Generate Hierarchical Tree from, Jeni Tennison |
Month |