-
Notifications
You must be signed in to change notification settings - Fork 0
Docs Webapp XMLXSL
Inspired by the Java framework Pustefix this view engine creates the view by applying XSL stylesheets on a XML tree created by the application.
To use the XML/XSL view engine you need to configure the appropriate processor in the web appconfiguration. This can be done by creating the configarion with stubUriConfigurator::createWithXmlProcessorAsDefault().
The engine creates the view in two steps:
- The processor handles the incoming request and creates a XML document that contains all required data to answer the request properly.
- Then it takes this XML document and applies a XSL stylesheet on it which results in the HTML that gets delivered back to the browser.
To make this clear we will take a look at the processing of a specific request. Let's assume that a route named "foo" is requested by the browser.
When the request comes to the XML processor, it first checks if such a route exists. This is done by checking if in the pages path a file named foo.ini exists in the subdirectory conf. If this is not the case it will respond with HTTP status code 404.
Within this route file the page is configured which means it has a list of all classes that should be executed on this request. (Simplified, more details can be found in the documentation about the route configuration.) The processor now executes the process() method of all these classes, and writes the return value of this method into a XML document using the XML serializer. Beside this some values will be serialized into the XML document by default, for instance some informations about the session and the request itself. The created XML document is written into the response object.
In a second step it creates a style sheet dynamically by applying the master.xsl stylesheet to the skin stylesheet which resides in a file default.xml in the skin subdirectory of the page path, which itself includes a file named main_foo.xml in the txt subdirectory of the page path. For every configured route in the conf directory a matching style sheet file should exist in the txt directory. Finally the generated XSL stylesheet gets applied to the XML document taken out of the response, and the result of this transformation replaces the contents of the response. These steps and how they can be influenced by your application are explained in detail in the stylesheets section.