Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » XML+XSL matters » Hacking into the XSLT process
Hacking into the XSLT process [message #1563] Fri, 22 August 2008 08:54 Go to next message
jsmeaton is currently offline  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 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2312
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'.


Re: Hacking into the XSLT process [message #1568 is a reply to message #1563] Sun, 24 August 2008 01:35 Go to previous messageGo to next message
jsmeaton is currently offline  jsmeaton
Messages: 9
Registered: May 2008
Junior Member
Basically what we want to do is export the data and screens for viewing/updating/inserting offline (without access to a database) with limited functionality of course. Instead of writing data to the database (on insert/update) we'd just write to an XML file then load that back in.

I was wondering though, how the buttons in the sub-menu are created and where to place code behind the buttons. For example, how is the 'add' button created and where would the code behind that button be?

If I see an example of how an existing button works, I can create my own also.

re. the include.xml.php file, thanks, I'll look into that tonight.
Re: Hacking into the XSLT process [message #1569 is a reply to message #1568] Sun, 24 August 2008 06:20 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2312
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.


Re: Hacking into the XSLT process [message #1570 is a reply to message #1563] Mon, 25 August 2008 00:07 Go to previous messageGo to next message
jsmeaton is currently offline  jsmeaton
Messages: 9
Registered: May 2008
Junior Member
Thanks for that Tony, much help.

Actually, what I would really appreciate your advice on is this... how would you go about creating an 'offline mode' for standalone users? We need to provide the functionality to export data & views/forms to a laptop, have someone go away for days at a time doing data entry on that data, then coming back and syncing.

This one is gonna be keeping me up nights if I don't get it sorted soon!

Of course if we implemented it we'd pass it on for you! Sharing IS caring after all. Cheers mate.
Re: Hacking into the XSLT process [message #1571 is a reply to message #1570] Mon, 25 August 2008 06:07 Go to previous message
AJM is currently offline  AJM
Messages: 2312
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.


Previous Topic: Change XSLT based on role
Next Topic: XSL error when supposedly using csxslt
Goto Forum:
  


Current Time: Sun Jan 29 06:50:45 EST 2023

Total time taken to generate the page: 0.01438 seconds