Re: [Xsltforms-support] Visualise an instance in a div
Brought to you by:
alain-couthures
From: William D. V. <wi...@bi...> - 2011-12-10 13:05:34
|
Here is a method for showing the instance in a DIV: 1. Put the div element somewhere in the page and style it to ease reading: <div id="xml_dump" style=" font-family: fixed;white-space: pre;"/> 2. Add the following script to do the job: <script type="text/javascript"> function insertLiteral(literalString, targetElement) { var textNode = document.createTextNode(literalString); targetElement.appendChild(textNode) return textNode; } function showInstance(){ var model = window.document.getElementById("xmodel"); // xmodel is the id of the xf:model var instance = model.getInstanceDocument('xins'); // xins is the if of the xf:instance inside your model var xml_dump = window.document.getElementById("xml_dump"); var xml = Core.saveXML(instance); var xmlTextNode = insertLiteral(xml, xml_dump); } </script> 3. Add a trigger to call the javascript: <xf:trigger> <xf:label>Show Instance</xf:label> <xf:action ev:event="DOMActivate"> <xf:load resource="javascript:showInstance()" /> </xf:action> </xf:trigger> > ------------------------------ > > Message: 2 > Date: Wed, 7 Dec 2011 01:02:52 -0800 > From: Stephen Cameron <ste...@gm...> > Subject: [Xsltforms-support] Visualise an instance in a div > To: xsl...@li... > Message-ID: > <CAG=ut6...@ma...> > Content-Type: text/plain; charset="iso-8859-1" > > Hello, > > I am interested in visualising an model instance in a scrolling <div> > on > the browser. > > I know exsltforms does this but is there any other way in recent > versions > of XSLTForms? > > Also is it possible to redirect the debug event information to a > second > window? > > Thanks > > Steve Cameron > -------------- next part -------------- > An HTML attachment was scrubbed... > > ------------------------------ |