Hacking into the XSLT process [message #1563] |
Fri, 22 August 2008 08:54 |
jsmeaton
Messages: 9 Registered: May 2008
|
Junior Member |
|
|
One of our requirements in a project I'm working on is the need to export data to portable XML files. Specifically, the client wants to be able to work offline and upload data back into the system on return.
An idea I've had is to hijack the XSLT process and instead write the generated HTML to file. I'd probably do this by including another button in the sub-menu (add/update/delete/export to file) and generating an entry point to the various screens in the exported package.
I'm not very good with xsl/xml but I've had a look at std.buttons.xsl and assume this is what generates the menu. Where does it get the information on what buttons to generate and what 'action' to give them?
Basically I'm after:
How do you print the buttons?
How do you code behind the buttons?
Your help would be greatly appreciated!
|
|
|
Re: Hacking into the XSLT process [message #1565 is a reply to message #1563] |
Fri, 22 August 2008 11:17 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
If you want to export data in XML format then why bother to go through an XSLT process? Why can't you have a process which outputs an XML file directly without including an XSL transform? You won't then have to modify an XSL stylesheet to do what you want.
There are already several examples in the framework of functions which export data to non-database files (such as the dictionary export and the menu subsystem export), so why can't you use one of those as a model? It is very easy with PHP to create an XML document and then write it out to disk.
All of the xsl templates get their data from the same source - the XML file which is generated from the PHP code just before the XSLT process is executed. The PHP code which creates the XML document can be found within file 'include.xml.php?.inc'.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Hacking into the XSLT process [message #1569 is a reply to message #1568] |
Sun, 24 August 2008 06:20 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
That submenu is known as the navigation bar and is populated using entries on the mnu_nav_button table. Each of these entries points to another task which is activated when the button is pressed.
All you need do is create a task which does what you want, then put it on the navigation bar of the relevant parent task.
If you look close enough you will see that the framework is littered with hundreds of examples, including the ones I have already identified for you in my previous post.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Hacking into the XSLT process [message #1571 is a reply to message #1570] |
Mon, 25 August 2008 06:07 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
One way I know of to have both online and offline versions of the same application is to use XFORMS, but I have never used this technology so am I unable to advise you on how to go about it.
An easy alternative would be to put a copy of Apache/PHP/MySQL on each laptop, with the appropriate databases. All you then have to worry about is synchronising the databases to keep them in step. One method of copying from a laptop to the central server may be to use the contents of the AUDIT database.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|