Samples

SamplesXml

Code

Config

API Docs

Download

Neolectric

dxp vs xslt

dxp model

dx pages follow a sequential execution pattern from top to bottom so it's easy to follow the page logic and sequence of events. You can also include code blocks from shared function pages which behave as if they are inserted into the calling page at the position they are included. A tree of DxpNodes and static content are cached when the page is compiled. A dynamic page is produced by writing the static and dynamic data to an output buffer. This does not require the creation of a new node tree for every request.

Properly designed DxpNodes are threadsafe which means they can process multiple requests at the same time. Tags store configuration information set by attributes or children. Dynamic results are stored back in the request under a parameter name which then gets passed on. This allows conditional execution and branching while the document is being generated rather than after it's finished. You can dynamically create and store any kind of object to pass on to other tags. You are not limited to Strings.

XSLT model

XSLT processing was first designed to transform a complete xml document into html on the client side. It's a powerful system to transform raw information to the desired display format specified by an xsl stylesheet. People began to do this on the server to support older browsers that could only handle html. It has also been used to perform simple application logic at the same time but options are constrained by the design of xml and xslt.

The execution sequence of an xslt transformation can be difficult to follow because it can jump around and invoke sections recursively. It generally requires a complete xml document to process. Data is passed between xslt formatting objects as Strings. Complex objects must be converted to nested xml before they can be processed.

Server overhead

In addition to complexity, xslt also adds overhead. When you generate dynamic content, you have to create a temporary xml document, pass it to the xslt processor to format and then send the result to the client. Your xml document will be converted to a tree of nodes called a DOM (document object model) to be processed by the xslt engine. This has to be done for every request that creates new content. The extra overhead is good news for hardware vendors and companies that sell software licenses per machine. Take note of the companies that are promoting this model.

If you are delivering html to your client you might as well create a dynamic html document in the first place and skip xslt processing on the server. The argument is often made that xsl stylesheets make it easy to control the look and feel of your site using a single set of templates. That's also easy to do with dxp by including common sections of html and dxp code from shared function pages. See Including common html code from the samples.

The raw xml alternative

Generating dynamic xml documents with dxp is just a easy as generating html. It makes a lot of sense if your clients can handle it because the files are generally smaller without html formatting. You can instruct the client browser to download an appropriate stylesheet to transform the xml content to an html display format on their local machine rather than your server. You can even let clients select between different stylesheets and insert the reference dynamically. Modern browsers support xslt processing and are waiting for webmasters to catch up.